The Fletcher-16 checksum is a lightweight error-detection algorithm devised by John G. Fletcher. It is far stronger than a plain modular byte sum because it is position-sensitive, yet it is cheap enough to run on small embedded devices. This calculator runs the exact algorithm in your browser over either UTF-8 text or raw hex bytes.
How it works
Fletcher-16 keeps two running sums, both reduced modulo 255:
- Start with
sum1 = 0andsum2 = 0. - For each byte
b: setsum1 = (sum1 + b) mod 255, thensum2 = (sum2 + sum1) mod 255. - The final checksum is
(sum2 << 8) | sum1—sum2is the high byte andsum1is the low byte.
Because sum2 accumulates every intermediate value of sum1, the checksum depends on the position of each byte, not just the total. Swapping two bytes changes the result, which a simple additive sum would miss entirely.
Worked example
For the ASCII string abcde (bytes 97, 98, 99, 100, 101):
Byte 97: sum1 = (0 + 97) mod 255 = 97 sum2 = (0 + 97) mod 255 = 97
Byte 98: sum1 = (97 + 98) mod 255 = 195 sum2 = (97 + 195) mod 255 = 37
Byte 99: sum1 = (195 + 99) mod 255 = 39 sum2 = (37 + 39) mod 255 = 76
Byte 100: sum1 = (39 + 100) mod 255 = 139 sum2 = (76 + 139) mod 255 = 215
Byte 101: sum1 = (139 + 101) mod 255 = 240 sum2 = (215 + 240) mod 255 = 200
Final checksum: (200 << 8) | 240 = 0xC8F0
Try abcde in the calculator and you will see 0xC8F0 — a quick sanity check for any implementation.
Fletcher-16 versus other lightweight checksums
Fletcher-16 occupies a useful middle ground between a simple sum and a full CRC:
| Checksum | Bits | Position-sensitive | Detects transpositions | Relative cost |
|---|---|---|---|---|
| Simple modular sum | 8 | No | No | Lowest |
| Fletcher-16 | 16 | Yes | Yes | Low |
| Adler-32 | 32 | Yes | Yes | Low |
| CRC-16 | 16 | Yes | Yes | Low-medium |
Fletcher-16 was originally designed for IP header checksums (RFC 905/1145) and is still used in some network protocols and embedded systems because it requires no lookup tables and runs efficiently on 8-bit microcontrollers. Fletcher-32 and Fletcher-64 scale the same approach to wider outputs for larger data.
The key advantage over a plain sum is the double-sum structure: a simple additive checksum cannot detect a swap of two bytes (because the sum is commutative), whereas Fletcher-16 will catch it. The modulus 255 rather than 256 is intentional — it avoids the all-zeros lock-in problem where a block of zeros would leave the running total unchanged.
Limitations
Fletcher-16 is an error-detection checksum, not a cryptographic hash. A motivated attacker can trivially construct a different message with the same Fletcher-16 value, so it offers no security properties. For integrity against deliberate tampering, use HMAC-SHA256 or a similar construction. For pure error-detection in constrained environments, Fletcher-16 remains a practical and reliable choice.
Everything here is computed locally in your browser — your data never leaves the device.