A cyclic redundancy check is a shift register fed one bit of your data at a time, and the whole family of them is described by five numbers: the width, the polynomial, the initial value loaded into the register, whether the algorithm is reflected, and a final XOR. Set those five and this page computes the CRC of whatever you type, shows you the algorithm running one step at a time, and writes the code to do it in C, C#, VB.NET or Delphi.
Everything runs in your browser. Nothing you type is uploaded, logged or sent anywhere.
A reflected algorithm feeds the register from the other end, so an implementation reverses the polynomial and the seed once up front rather than reversing every byte. These are the numbers the generated code actually contains.
Written for the parameters above rather than as a configurable routine, so the constants are folded in, only the branch you need survives, and a final XOR of zero disappears entirely. Each snippet comes with a resumable form that takes a CRC returned earlier and carries on from it, so a stream too large to hold in memory can be checksummed a piece at a time and still land on the same value.
Treat the message as one enormous binary number and divide it, using carry-free binary arithmetic, by a constant called the generator polynomial. The remainder is the CRC. Because there are no carries, that division is nothing more than a shift register and a conditional XOR, which is why a CRC costs so little in hardware and why the same handful of parameters describes every variant in use.
The lookup table is a shortcut, not a different algorithm. The eight shifts for a given byte depend only on that byte and on the eight register bits it meets, so all 256 possible outcomes can be worked out once and stored. Both forms are generated above and they always agree.
Reflection exists because serial hardware transmits the least significant bit first. Rather than
reverse every byte on the way in and reverse the result on the way out, an implementation reverses the polynomial
and the seed once and runs the register backwards. The Working constants panel shows both numbers, which is why the
seed printed in the generated code for an algorithm like CRC-16/RIELLO is 0x554D even though the
published initial value is 0xB2AA.
The check value is the agreed fingerprint of an algorithm: the CRC of the nine ASCII characters
123456789. Every preset here is verified against its published check value, so if your own code
reproduces the number shown in the Result panel, your implementation is right.
Every control can be set from the query string, so a particular calculation can be bookmarked, shared or linked from a datasheet or bug report. The address bar keeps itself up to date as you work, and Copy link puts the current link on the clipboard.
/apps/crc-calculator/?width=32&poly=0xA833982B&init=0xFFFFFFFF&reflect=true&xor=0xFFFFFFFF&data=0132356E
width — 8, 16, 32 or 64.poly, init, xor — hexadecimal, with the 0x prefix
optional. xorout is accepted in place of xor.
reflect — true or false, and 1 or 0 also
work. reverse, ref and refin are accepted as aliases.
preset — a preset name such as CRC-32/ISO-HDLC, which fills in all four
parameters. Aliases work too, so preset=CRC-32 finds the same entry.
data — the input as hexadecimal bytes. text supplies it as plain text instead.
mode — hex or text, to say which of the two above the input box
should start in.
lang — which code tab opens: c, csharp, vbnet or
delphi.
algo — table or bitwise, selecting the generated form.
trace — bit or byte, the playback granularity, and
step — a step number to open the playback at.
A parameter that cannot be read is ignored and flagged rather than quietly changing the answer, so a mistyped link
is easy to spot. Add ?selftest=1 to run every preset against its published check value and see the
results.