CRC Calculator

CRC-8 / CRC-16 / CRC-32 from text or hex — any polynomial, with C code.

Bitwise C implementation:

What the parameters mean

A CRC treats the message as one long binary number and divides it (modulo-2) by a generator polynomial; the remainder is the checksum. The same six parameters — the Rocksoft model — describe every common CRC:

  • Width — 8, 16 or 32 bits of result.
  • Poly — the generator (e.g. 0x1021 for CCITT, 0x8005 for Modbus, 0x04C11DB7 for CRC-32).
  • Init — the starting register value (often all-ones).
  • RefIn / RefOut — whether each input byte and the final result are bit-reversed; reflected CRCs (Modbus, CRC-32) process bits LSB-first.
  • XorOut — a value XORed into the final result.

Two implementations with the right poly but a different init or reflection will produce completely different checksums — which is exactly why "my CRC doesn't match the device" tickets are so common. Match all six against the datasheet. The C below is the bitwise form (no lookup table) — correct and tiny; for throughput, generate a 256-entry table from the same parameters.