Custom CRC Calculator
Fully parameterized CRC: width, poly, init, reflect, xorout.
9 bytes in
This tool computes a CRC from the full Rocksoft parameter model — width (1–32 bits), polynomial, initial value, input/output reflection and final XOR — so you can reproduce any CRC a datasheet throws at you. Load a known preset as a starting point, or dial in parameters manually. The page loads with poly 0xD5, init 0xFF: over ASCII 123456789 that yields 0x7C.
How it works
Every CRC is polynomial division over GF(2): the message is treated as a long binary polynomial, divided by the generator polynomial, and the remainder is the checksum. Five parameters pin down the exact algorithm. The register starts at Init. Each message byte (bit-reversed first if RefIn) is fed in most-significant bit first; whenever a 1 exits the register's top bit, the register is XORed with Poly. After the last byte, the register is bit-reversed if RefOut and XORed with XorOut.
Two models with the same polynomial can produce completely different values — always validate against a known check value, conventionally the CRC of the ASCII string 123456789.
Worked example
input : 123456789 (ASCII)
CRC : 0x7C
Compare with standard CRC-8 (poly 0x07, init 0x00) which gives 0xF4 for the same input — same width, different model, different result.
Parameters
| Parameter | Value | Notes |
|---|---|---|
| Width | 1–32 bits | CRC size = remainder size |
| Poly | hex, normal notation | e.g. 0x07, 0x1021, 0x04C11DB7 |
| Init | hex | register start value |
| RefIn / RefOut | true | false | bit-reverse input bytes / final register |
| XorOut | hex | XORed into the final value |
Python implementation
# Fully parameterized CRC (Rocksoft model), width 1..32.
def crc(data: bytes, width, poly, init, refin, refout, xorout):
mask = (1 << width) - 1
top = 1 << (width - 1)
reg = init & mask
for byte in data:
if refin:
byte = int(f"{byte:08b}"[::-1], 2)
for b in range(7, -1, -1):
bit = (byte >> b) & 1
flag = ((reg & top) != 0) ^ bit
reg = (reg << 1) & mask
if flag:
reg ^= poly
if refout:
reg = int(bin(reg)[2:].zfill(width)[::-1], 2)
return reg ^ xorout
# Worked example: poly 0xD5, init 0xFF -> 0x7C
assert crc(b"123456789", 8, 0xD5, 0xFF, False, False, 0x00) == 0x7CFAQ
▸What do the five parameters mean?
Width is the CRC size in bits. Poly is the generator polynomial (normal, unreflected notation). Init is the register's starting value. RefIn/RefOut reverse the bit order of input bytes and of the final register. XorOut is XORed into the register at the very end. Together these form the Rocksoft parameter model that uniquely defines a CRC.
▸How do I find the parameters for my unknown device CRC?
If the documentation names an algorithm, load it from the preset list. If you only have example frames with known-good CRCs, adjust parameters until the output matches — or use the CRC Identifier tool, which searches the catalog automatically.
▸Why does my result differ from another site for the same polynomial?
The polynomial alone does not define a CRC. Different init, reflection or xorout values produce different results — for example the default parameters on this page (poly 0xD5, init 0xFF) give 0x7C over 123456789, while plain CRC-8 (poly 0x07, init 0x00) gives 0xF4.
▸Does it support widths that are not a multiple of 8?
Yes — any width from 1 to 32 bits. Sub-byte widths such as CRC-4 or CRC-5 are processed bit-by-bit internally.
▸Is my data uploaded?
No. All computation happens locally in your browser.