Fletcher-16 is a position-sensitive checksum that uses two simple byte-sized running sums. It is far cheaper to compute than a CRC, which is why it shows up in low-power protocols and embedded firmware, while still catching the common single-bit and short burst errors. This tool computes it over the UTF-8 bytes of your text.
How it works
Two 8-bit accumulators, sum1 and sum2, are both reduced modulo 255:
sum1 = 0, sum2 = 0
for each byte b:
sum1 = (sum1 + b) mod 255
sum2 = (sum2 + sum1) mod 255
checksum = (sum2 << 8) | sum1
sum1 is a plain running total of the byte values. sum2 adds up every
intermediate sum1, which makes the result depend on the order of the bytes,
not just their values — so swapping two bytes changes the checksum. The two
sums are packed into a single 16-bit value with sum2 in the high byte.
Tips and notes
- The reference input
"abcde"yields0xC8F0— handy for confirming a port of the algorithm matches. - The mod-255 reduction is deliberate: a mod-256 (byte-wraparound) sum has well-known blind spots, and 255 avoids them.
- Fletcher-16 is for integrity only, not security; it is trivial to construct a different message with the same checksum.
- Larger relatives exist — Fletcher-32 (two 16-bit sums mod 65535) and Fletcher-64 — offering stronger detection at higher cost.
Fletcher-16 versus other checksums
Choosing the right checksum depends on the cost budget and error-detection requirements:
| Checksum | Width | Detects burst errors | Detects reordering | Cost |
|---|---|---|---|---|
| Simple sum | 8–32 bit | No (only single-bit) | No | Minimal |
| Fletcher-16 | 16 bit | Yes (short bursts) | Yes | Very low |
| Fletcher-32 | 32 bit | Yes (longer bursts) | Yes | Low |
| Adler-32 | 32 bit | Similar to Fletcher-32 | Yes | Low |
| CRC-16 | 16 bit | Yes (polynomial-based) | Yes | Low–medium |
| CRC-32 | 32 bit | Strong burst detection | Yes | Medium |
| SHA-256 | 256 bit | Designed for security | Yes | High |
Fletcher-16 sits between the trivially weak simple sum and the heavier CRC in both cost and detection capability. The key advantage over a simple sum is that sum2’s position-dependence catches byte swaps and reorderings — failures that a plain sum-of-bytes misses entirely.
Where Fletcher-16 appears in real protocols
Several embedded systems and network protocols have used Fletcher-style checksums:
- IS-IS (Intermediate System to Intermediate System): the link-state routing protocol used in large ISP networks uses a Fletcher checksum in its PDU headers
- OSPF: also uses a Fletcher checksum for Link State Advertisement (LSA) integrity
- DNP3: a protocol used in industrial control systems and power grid SCADA uses Fletcher-16 for data link layer integrity
- Bootloader protocols: many microcontroller bootloaders use Fletcher-16 because it can be implemented in roughly a dozen lines of C without a lookup table, important when flash and RAM are measured in kilobytes
The mod-255 algorithm requires only addition and modular reduction — no multiplication, no table lookup, and it can run on an 8-bit processor in a tight loop, which is exactly what makes it appealing for small embedded targets.
Verifying an implementation
Three well-known test vectors are useful for checking a port of the algorithm:
| Input | Expected Fletcher-16 (hex) |
|---|---|
abcde | 0xC8F0 |
abcdef | 0x2057 |
abcdefgh | 0x0627 |
If your implementation produces all three correctly, it is almost certainly right. If it produces the correct sum1 but wrong sum2, the most common cause is applying the modulo to the final value instead of (or in addition to) applying it after each byte.