Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

CRC Calculator (CRC-8/16/32/64)

Every catalogued CRC, custom parameters, checksums and C code — for text, hex or files.

Developer No upload Works offline Free, no sign-up

Data

9 bytes (UTF-8).

Algorithm

Result

CRC —
Hex
Decimal
Binary
Bytes, MSB first
Bytes, LSB first

Hex (any byte order) or decimal after #. Matching catalogue algorithms are highlighted below.

All 113 catalogue CRCs of this data

AlgorithmBitsCRC (hex)

Other checksums

Adler-32 zlib / RFC 1950: sums modulo 65521, A starts at 1.
—
Fletcher-16 8-bit words, sums modulo 255.
—
Fletcher-32 16-bit little-endian words (odd length zero-padded), modulo 65535.
—
Fletcher-64 32-bit little-endian words (zero-padded), modulo 2³² − 1.
—
Internet checksum RFC 1071 (IP, TCP, UDP, ICMP): ones’ complement of the ones’-complement sum of 16-bit big-endian words.
—
POSIX cksum What the cksum command prints: CRC-32/CKSUM of the data followed by its length.
—
Sum-8 Sum of all bytes modulo 256.
—
LRC-8 Two’s complement of Sum-8, as in Modbus ASCII (the bytes plus the LRC sum to 0).
—
XOR-8 All bytes XORed together (BCC; NMEA 0183 sentences use it between $ and *).
—

C code for this CRC

C99, no dependencies: init, update and final functions plus a one-call version.

 

Next steps

About the CRC Calculator (CRC-8/16/32/64)

A cyclic redundancy check (CRC) is the error-detecting code behind ZIP and PNG files, Ethernet, Modbus, CAN, USB, SD cards and countless serial protocols. This calculator computes it for text (as UTF-8 bytes), hex bytes such as 01 03 00 00 00 0A, or files of any size, with all 113 algorithms of Greg Cook’s CRC RevEng catalogue — from CRC-3/GSM to CRC-82/DARC — or with your own width, polynomial, initial value, reflection and final XOR.

Every preset is tested against its catalogue check value (the CRC of the text 123456789). Not sure which CRC a device uses? Enter a message and the CRC you expect, and the table of all 113 algorithms highlights the ones that match — also when the CRC bytes are in the opposite order. The page also gives Adler-32, Fletcher-16/32/64, the Internet checksum, POSIX cksum, Sum-8, LRC and XOR checksums, and C code (table-driven or bit by bit) for the chosen CRC.

How to use it

  1. Choose Text, Hex bytes or File and enter the data. Text is turned into UTF-8 bytes; hex can be written as 31 32 33, 0x31, 0x32, 0x33 or 313233.
  2. Pick the algorithm. The most used ones come first, then every catalogue entry by width. Choose Custom parameters to enter width, poly, init, refin, refout and xorout from a datasheet — the page tells you if they match a catalogue entry.
  3. Read the CRC in hex, decimal and binary, and as bytes in both orders, ready to append to a frame.
  4. To identify an unknown CRC, type the value you expect under Compare with an expected CRC. Matching algorithms are highlighted in the list of all catalogue CRCs.
  5. Copy or download C code for the chosen CRC, with init, update and final functions.

Examples

The standard check string
Input
Text: 123456789
Result
CRC-32/ISO-HDLC = 0xCBF43926 · CRC-16/MODBUS = 0x4B37 · CRC-8/SMBUS = 0xF4

These are the catalogue check values. A correct implementation of an algorithm must give its check value for this input.

A Modbus RTU request
Input
Hex: 01 03 00 00 00 0A   (CRC-16/MODBUS)
Result
CRC = 0xCDC5 → the frame ends with C5 CD

Modbus sends the CRC low byte first, so the bytes on the wire are the reverse of the hex value.

One polynomial, three answers
Input
Text: 123456789, poly 0x1021
Result
CRC-16/XMODEM 0x31C3 · CRC-16/IBM-3740 (“CCITT-FALSE”) 0x29B1 · CRC-16/KERMIT (“CCITT”) 0x2189

All three use x¹⁶ + x¹² + x⁵ + 1. They differ in the initial value (0x0000 or 0xFFFF) and in whether bits are processed least significant first.

Common uses

  • Checking the CRC of a Modbus, CAN, SMBus or other serial frame while writing or debugging firmware.
  • Working out which CRC variant a device or file format uses from a sample message and its CRC.
  • Verifying that a firmware image or download matches a published CRC-32.
  • Generating a lookup table and C functions for a microcontroller.
  • Computing Adler-32, Fletcher or Internet checksums for protocol work and test vectors.

The six parameters of a CRC

Every CRC here is described by the Rocksoft model from Ross N. Williams’ A Painless Guide to CRC Error Detection Algorithms, which the RevEng catalogue also uses:

  • width — the number of bits in the CRC.
  • poly — the generator polynomial in normal (MSB-first) notation with the top term left out: CRC-32’s x³² + x²⁶ + x²³ + … + x + 1 is written 0x04C11DB7.
  • init — the register value before the first byte.
  • refin — true if each byte is processed least significant bit first (a “reflected” CRC, typical of UARTs and Modbus).
  • refout — true if the final register is bit-reversed before the final XOR.
  • xorout — a value XORed into the result at the end.

The catalogue adds check (the CRC of 123456789) and residue (what a receiver’s register holds after reading a message with a correct CRC, before the final XOR).

Why “CRC-CCITT” has so many answers

The polynomial 0x1021 was standardised by the CCITT (now ITU-T) in Recommendation V.41, but programs that call themselves “CRC-CCITT” disagree on the other parameters. The RevEng catalogue calls the LSB-first form of V.41 CRC-16/KERMIT (check 0x2189) and its MSB-first counterpart CRC-16/XMODEM (0x31C3). The very common variant with init 0xFFFF, often labelled “CCITT-FALSE”, is CRC-16/IBM-3740 (0x29B1), which the catalogue notes is “commonly misidentified as CRC-CCITT”. Compare check values rather than names when matching a datasheet.

Which byte of the CRC goes first

The value is the same however it is sent, but protocols store it differently. MSB-first CRCs such as CRC-16/XMODEM are usually sent most significant byte first (big-endian); reflected ones such as CRC-16/MODBUS are usually sent least significant byte first. File formats choose for themselves: ZIP stores its CRC-32 little-endian, PNG big-endian. The result panel shows both byte orders, and the expected-value search also accepts a CRC with its bytes swapped.

The other checksums

  • Adler-32 (RFC 1950): two sums modulo 65521, the check value at the end of every zlib stream.
  • Fletcher-16/32/64: two running sums modulo 255, 65535 or 2³² − 1, over 8-, 16- or 32-bit words; the wider ones read little-endian words and pad an odd tail with zeros.
  • Internet checksum (RFC 1071): the ones’ complement of the ones’-complement sum of 16-bit words, used in IPv4, TCP, UDP and ICMP headers.
  • POSIX cksum: CRC-32/CKSUM of the data followed by the data’s length, exactly what the cksum command prints (in decimal).
  • Sum-8, LRC-8 and XOR-8: simple 8-bit sums used by many serial protocols; LRC-8 is the Modbus ASCII check.

Limitations

  • Text is encoded as UTF-8, and line breaks typed or pasted into the box count as a single LF byte. To checksum a file byte for byte, use File.
  • The list of all 113 catalogue CRCs is calculated for data up to 16 MB (for files over 1 MB when you ask for it, with one button). Larger files get the selected CRC and the checksums, read in 4 MB pieces in the background.
  • C code is generated for CRCs up to 64 bits wide. Custom models can be up to 128 bits wide.
  • The search compares your expected value with the catalogue; it does not reverse-engineer an unknown polynomial from codewords. For that, use the CRC RevEng command-line program.

Privacy

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

Why does my CRC-32 not match?

Check, in this order: that you are computing over exactly the same bytes (text encoding, line endings, whether a header or the CRC field itself is included); that you compare in the same byte order; and that it is really CRC-32/ISO-HDLC (zlib, ZIP, PNG, Ethernet) and not CRC-32C (iSCSI, ext4, SSE4.2), CRC-32/BZIP2 or CRC-32/MPEG-2, which give different values. Enter the expected value to see which algorithm produces it.

How can I find out which CRC my device uses?

Take a message from the device whose CRC you know, choose Hex bytes, paste the message without the CRC, and type the CRC under Compare with an expected CRC. Every catalogue algorithm that gives that value is highlighted, including matches with the bytes swapped. Check a second message to rule out coincidences.

What do refin and refout (“reflected”) mean?

Hardware that sends bytes least significant bit first, such as a UART, naturally computes the CRC with each byte bit-reversed. refin=true models that; refout=true bit-reverses the final value. Most reflected CRCs set both. A few models, such as CRC-12/UMTS, set only one.

Why is cksum’s number different from CRC-32/CKSUM?

The cksum command runs CRC-32/CKSUM over the file and then over the file’s length (in as few bytes as possible, least significant first), and prints the result in decimal. The POSIX cksum row reproduces that; the CRC-32/CKSUM preset is the plain algorithm, whose check value is 0x765E7680.

Is my data uploaded?

No. Text, hex and files are processed by your browser on your device; files are read in pieces locally and nothing is sent anywhere. The page keeps working offline once loaded.

Can I use the generated C code in my project?

Yes — it is plain C99 with no dependencies, and the comment at the top states the model and a self-test. The table-driven version uses a 256-entry table and one lookup per byte; the bitwise version has no table and is smaller, but does eight steps per byte, so it is slower.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.