ThisCalculator

Everyday

CRC Calculator Online Polynomial: How to Use

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

A CRC (Cyclic Redundancy Check) calculator online lets you compute the checksum for a block of data using a chosen polynomial. You enter the data (often as hex or binary) and the polynomial, and the calculator returns the CRC value, usually in hex. This article explains how these calculators work, how to choose a polynomial, and common pitfalls to avoid.

Formula

The CRC is computed by treating the input data as a long binary number and dividing it by the polynomial (also binary) using modulo-2 division (no carries). The remainder is the CRC. The process is:

  • Append zeros to the data (the number of zeros equals the polynomial degree, e.g., 32 for a 32-bit CRC).
  • Perform XOR (exclusive OR) division, not arithmetic division.
  • The remainder after division is the raw CRC.

In the calculator above, the expression crc32(data, poly, init, refin, refout, xorout) is a built-in function that performs the standard CRC-32 algorithm with the given parameters. The variables are:

  • Data (hex): the input bytes, e.g., “313233” for ASCII “123”.
  • Polynomial (hex): the generator polynomial, often written without the leading 1 (e.g., 0x04C11DB7 for CRC-32).
  • Initial value (hex): the starting value of the CRC register, often 0xFFFFFFFF.
  • Reflect input: if 1, each input byte is bit-reversed before processing.
  • Reflect output: if 1, the final CRC is bit-reversed.
  • XOR output: a value XORed with the final CRC.

The result is the CRC checksum, typically displayed in hexadecimal.

Worked Example

Using the default values: data = “313233” (ASCII “123”), polynomial = 0x04C11DB7, init = 0xFFFFFFFF, reflect in/out = 1, XOR out = 0xFFFFFFFF.

  1. Start with the register = init = 0xFFFFFFFF.
  2. For each byte of data (0x31, 0x32, 0x33): reflect the byte (bit-reverse) and process it into the register using the polynomial.
  3. After all bytes, reflect the register and XOR with 0xFFFFFFFF.
  4. The result is the CRC-32 value, which for “123” is 0x884863D2 (a common result).

The calculator above will show the same result when you click Calculate.

How CRC Works: The Math Behind the Curtain

CRC is a type of hash function that detects accidental changes to data. It is not cryptographically secure, but it is excellent for detecting transmission errors. The polynomial acts as a divisor; the remainder is the checksum. The key properties:

  • The polynomial degree determines the CRC width (e.g., 32-bit CRC uses a 33-bit polynomial).
  • Common polynomials: CRC-16-CCITT (0x1021), CRC-32 (0x04C11DB7), CRC-64-ECMA (0x42F0E1EBA9EA3693).
  • Reflection and initial values are parameters that must match between sender and receiver.

How to Choose a Polynomial

Choosing a polynomial depends on your application:

  • Error detection strength: Some polynomials are better at detecting certain bit errors. For general use, standard polynomials like CRC-32 are well-tested.
  • Compatibility: If you are communicating with an existing system, you must use the same polynomial and parameters as that system.
  • Performance: Lower-degree polynomials are faster but provide less protection.

For new designs, pick a widely used polynomial and document the parameters (init, reflection, XOR out) so others can reproduce it.

Common Mistakes and Pitfalls

  • Byte order: Data can be fed MSB-first or LSB-first. Reflection settings control this.
  • Polynomial representation: Some sources list the polynomial including the leading 1 (e.g., 0x104C11DB7) while others omit it. The calculator expects the value without the leading 1.
  • Initial value: Using 0x00000000 vs 0xFFFFFFFF changes the result. Always match the specification.
  • XOR out: Forgetting to XOR the final value can produce a different checksum.

CRC vs. Checksum vs. Hash

CRC is often confused with simple checksums (like sum of bytes) or cryptographic hashes (like SHA-256). The differences:

  • Checksum: Simple addition, detects only some errors, easy to compute.
  • CRC: Polynomial division, detects many burst errors, fast in hardware.
  • Hash: Designed to be collision-resistant, but slower and not meant for error detection.

For error detection in network packets or storage, CRC is the standard choice.

Limitations of CRC

CRC is not foolproof. It cannot detect all possible errors; for example, if the data is corrupted in a way that the remainder remains the same, the error goes unnoticed. Also, CRC is not suitable for security purposes—an attacker can easily forge a CRC. For integrity against malicious changes, use a cryptographic hash.

Frequently Asked Questions

What is the difference between CRC-32 and CRC-32C?

CRC-32 uses polynomial 0x04C11DB7, while CRC-32C (Castagnoli) uses 0x1EDC6F41. CRC-32C is faster on some hardware and has better error detection for some workloads, but they are not interchangeable.

Why do I get different results from different CRC calculators?

Because they may use different parameters: initial value, reflection, XOR out, or byte order. Always check the parameters and match them to your specification.

Can I use CRC for file integrity checks?

Yes, but only for accidental corruption. For security, use SHA-256 or similar. CRC is not collision-resistant.

What does ‘reflected input’ mean?

It means each byte is bit-reversed before processing. Some protocols use reflected input/output to simplify hardware implementation.

Is there a standard CRC for Ethernet?

Yes, Ethernet uses CRC-32 with polynomial 0x04C11DB7, initial value 0xFFFFFFFF, reflection on both input and output, and XOR out 0xFFFFFFFF.

How do I convert a CRC result to binary?

Each hex digit converts to four binary digits. For example, hex ‘A’ is binary 1010. The calculator shows the result in hex, but you can convert manually.

Related

Formula used
in data | Data (hex) | - | 313233 | 0
in poly | Polynomial (hex) | - | 04C11DB7 | 0
in init | Initial value (hex) | - | FFFFFFFF | 0
in refin | Reflect input? | - | 1 | 0
in refout | Reflect output? | - | 1 | 0
in xorout | XOR output (hex) | - | FFFFFFFF | 0
out crc | CRC-32 | hex | crc32(data, poly, init, refin, refout, xorout) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.