CRC-8 Calculator
CRC-8 with selectable polynomial and init variants.
9 bytes
This tool computes 8-bit CRCs over hex bytes or ASCII text in the two models that dominate practice: plain CRC-8 (polynomial 0x07) and CRC-8/MAXIM, the reflected polynomial 0x31 algorithm used by Dallas/Maxim 1-Wire sensors. Reference check values over 123456789: plain 0xF4, MAXIM 0xA1.
How it works
Like every CRC, an 8-bit CRC is the remainder of dividing the message by a generator polynomial over GF(2) — just with an 8-bit register. Plain CRC-8 feeds bits most-significant first with polynomial 0x07 and a zero initial register. CRC-8/MAXIM reflects input and output, so practical code keeps the register reversed and shifts right with the mirrored polynomial 0x8C: XOR the byte in, then eight shift-and-XOR steps.
One byte of check data is a deliberate trade-off: it catches all single- and double-bit errors and 8-bit bursts on short sensor frames while adding minimal overhead — exactly the regime of 1-Wire scratchpads, SMBus PEC-style links and small register protocols.
Worked example
CRC-8 (0x07) : 0xF4
CRC-8/MAXIM: 0xA1 (poly 0x31 reflected = 0x8C)
Parameters
| Parameter | Value | Notes |
|---|---|---|
| CRC-8 | poly 0x07 · init 0x00 · no reflect | check 0xF4 |
| CRC-8/MAXIM | poly 0x31 · init 0x00 · reflected | check 0xA1 · 1-Wire |
| Width | 8 bits | detects 8-bit bursts |
| Other models | Custom CRC tool | any poly/init/xorout |
C implementation
#include <stdint.h>
#include <stddef.h>
/* CRC-8/MAXIM (Dallas 1-Wire): poly 0x31 reflected -> 0x8C,
* init 0x00, refin/refout. "123456789" -> 0xA1 */
uint8_t crc8_maxim(const uint8_t *data, size_t len)
{
uint8_t crc = 0x00;
for (size_t i = 0; i < len; i++) {
crc ^= data[i];
for (int b = 0; b < 8; b++)
crc = (crc & 1) ? (crc >> 1) ^ 0x8C : crc >> 1;
}
return crc;
}FAQ
▸Which CRC-8 variants does this page compute?
Plain CRC-8 (polynomial 0x07, init 0x00, no reflection — check value 0xF4 over 123456789) and CRC-8/MAXIM (polynomial 0x31 reflected, init 0x00, check 0xA1), the algorithm Dallas/Maxim 1-Wire devices such as the DS18B20 use for their scratchpad and ROM CRCs.
▸My sensor datasheet says poly 0x31 but my result doesn't match — why?
Reflection is the usual culprit: CRC-8/MAXIM processes bits LSB-first, which is equivalent to using the reversed polynomial 0x8C in code. If your implementation shifts left with 0x31 without reflecting, you compute a different (also valid, but incompatible) CRC. The Custom CRC tool lets you match any parameter set exactly.
▸When is an 8-bit CRC enough?
For short frames — a handful of bytes on a sensor bus — CRC-8 detects all single- and double-bit errors and any burst up to 8 bits, at the cost of a single byte. Longer frames or noisier links usually step up to CRC-16.
▸How can I verify this calculator?
Type 123456789 in ASCII mode: plain CRC-8 must give 0xF4 and CRC-8/MAXIM 0xA1. Both values are pinned in this site's automated test suite.
▸Is my data uploaded?
No. Everything is computed locally in your browser.