What checksums are for

A checksum is a short number computed from the data that changes when even a single bit changes. The receiver computes it again and compares it with the one sent: if they differ, the data was damaged on the way. The CRC-32 of “123456789” is CBF43926, the check value used to test an implementation.

Different algorithms serve different settings. CRC-32 is the one in ZIP, PNG and Ethernet; CRC-32C in iSCSI, ext4 and Btrfs; CRC-16/MODBUS in Modbus RTU industrial devices; CRC-16/CCITT and XMODEM in serial protocols and smart cards; Adler-32 in zlib compression, faster but weaker on short data.

There are so many CRC-16 variants because they change polynomial, initial value, bit reflection and final XOR: that is why the same message gives different results. If you have a value to check and do not know the algorithm, paste it into the expected-value field and the calculator looks for the one that matches.

Common mistakes

  • Computing the checksum of the text instead of the bytes: "0A" as text is two characters, as hex a single byte.
  • Mixing up CRC-16 variants: MODBUS, ARC and CCITT give different results on the same data.
  • Using a CRC to verify downloads from untrusted sources: it is easy to forge; SHA-256 is needed.

Frequently asked questions

Why does the Modbus CRC look byte-swapped?

Modbus sends the CRC low byte first. If the computed value is 4B37, the message carries the bytes 37 4B.

How does CRC-32 differ from CRC-32C?

They use different polynomials: Castagnoli's (32C) detects some errors better and has dedicated instructions in modern processors, so it is preferred in storage and fast networks.

Can two different files have the same checksum?

Yes: 32 bits give about 4 billion values, so chance collisions happen across large numbers of files, and building one on purpose is trivial.

How this calculation works

CRC: the data is treated as a polynomial over bits and divided by a generator polynomial; the remainder is the checksum. Each variant is defined by width, polynomial, initial value, input and output reflection and final XOR (for example CRC-32: 32 bits, 0x04C11DB7, initial 0xFFFFFFFF, reflected, XOR 0xFFFFFFFF). Adler-32: A = 1 + sum of the bytes, B = sum of the running values of A, both modulo 65521, result B·65536 + A. Fletcher-16: the same modulo 255 without the initial 1.