CRC8 Calculator
Calculate an 8-bit CRC for text or hex bytes. The table under the calculator shows all 20 CRC-8 variants for your input, so you can match the one your sensor, bus or protocol uses. CRC8 計算(日本語)
ResultCRC-8
- Decimal
- 244
- Binary
- 11110100
- Bytes, big-endian
- F4
- Bytes, little-endian
- F4
Check value for "123456789": 0xF4
Source code for this CRC
Generated for the parameters above. Bit-by-bit and table-free, so it is easy to port to a microcontroller.
#include <stddef.h>
#include <stdint.h>
uint8_t crc_8(const uint8_t *data, size_t len)
{
uint8_t crc = 0x00;
while (len--) {
crc ^= (uint8_t)*data++;
for (int i = 0; i < 8; i++)
crc = (crc & 0x80) ? (crc << 1) ^ 0x07 : crc << 1;
}
return crc;
}
All CRC algorithms for this input
Click a row to load its parameters into the calculator.
| Algorithm | Result | Poly | Init | RefIn | RefOut | XorOut | Check | Used in |
|---|---|---|---|---|---|---|---|---|
| 0xF4 | 0x07 | 0x00 | false | false | 0x00 | 0xF4 | SMBus PEC, I2C sensors | |
| 0xA1 | 0x31 | 0x00 | true | true | 0x00 | 0xA1 | Dallas/Maxim 1-Wire (DS18B20) | |
| 0xD0 | 0x07 | 0xFF | true | true | 0x00 | 0xD0 | Robust Header Compression | |
| 0xA1 | 0x07 | 0x00 | false | false | 0x55 | 0xA1 | ATM HEC (ITU-T I.432.1) | |
| 0x4B | 0x1D | 0xFF | false | false | 0xFF | 0x4B | Automotive SAE J1850, AUTOSAR E2E | |
| 0xDF | 0x2F | 0xFF | false | false | 0xFF | 0xDF | AUTOSAR E2E profiles | |
| 0xDA | 0x9B | 0xFF | false | false | 0x00 | 0xDA | CDMA2000 mobile | |
| 0x15 | 0x39 | 0x00 | true | true | 0x00 | 0x15 | Data Radio Channel | |
| 0xBC | 0xD5 | 0x00 | false | false | 0x00 | 0xBC | DVB-S2 baseband header | |
| 0x97 | 0x1D | 0xFF | true | true | 0x00 | 0x97 | AES3 / EBU digital audio | |
| 0x7E | 0x1D | 0xFD | false | false | 0x00 | 0x7E | Philips I-CODE RFID | |
| 0x25 | 0x9B | 0x00 | true | true | 0x00 | 0x25 | WCDMA mobile | |
| 0x26 | 0xA7 | 0x00 | true | true | 0x00 | 0x26 | Bluetooth HEC | |
| 0xEA | 0x9B | 0x00 | false | false | 0x00 | 0xEA | LTE (3GPP TS 36.212) | |
| 0xF7 | 0x31 | 0xFF | false | false | 0x00 | 0xF7 | HD Radio, Sensirion SHT sensors | |
| 0x3E | 0x2F | 0x00 | false | false | 0x00 | 0x3E | openSAFETY | |
| 0x37 | 0x1D | 0x00 | false | false | 0x00 | 0x37 | GSM | |
| 0x94 | 0x49 | 0x00 | false | false | 0xFF | 0x94 | GSM | |
| 0xB4 | 0x1D | 0xFF | false | false | 0x00 | 0xB4 | HITAG RFID | |
| 0x99 | 0x1D | 0xC7 | false | false | 0x00 | 0x99 | MIFARE application directory |
Common CRC8 variants
An 8-bit CRC protects short messages: a sensor reading, a command byte, a packet header. Because every vendor picked its own parameters, "CRC8" covers a family of incompatible algorithms. The check value is the CRC of the ASCII string 123456789.
| Variant | Poly | Init | Reflected | XorOut | Check | Used in |
|---|---|---|---|---|---|---|
| CRC-8 (SMBus, ATM) | 07 | 00 | no | 00 | F4 | SMBus PEC, I²C sensors, MLX90614 |
| CRC-8/MAXIM | 31 | 00 | yes | 00 | A1 | 1-Wire: DS18B20, iButton |
| CRC-8/NRSC-5 | 31 | FF | no | 00 | F7 | Sensirion SHT3x, SCD4x, SGP |
| CRC-8/SAE-J1850 | 1D | FF | no | FF | 4B | OBD, AUTOSAR E2E profile 1 |
| CRC-8/AUTOSAR | 2F | FF | no | FF | DF | AUTOSAR E2E profile 2 |
| CRC-8/ROHC | 07 | FF | yes | 00 | D0 | Robust Header Compression |
| CRC-8/ITU | 07 | 00 | no | 55 | A1 | ATM header error control |
| CRC-8/DVB-S2 | D5 | 00 | no | 00 | BC | DVB-S2, CRSF radio link |
| CRC-8/BLUETOOTH | A7 | 00 | yes | 00 | 26 | Bluetooth header check |
CRC8 in C
The plain CRC-8 with polynomial 0x07. For another non-reflected variant, change the polynomial, the starting value and the final XOR.
uint8_t crc8(const uint8_t *data, size_t len)
{
uint8_t crc = 0x00;
while (len--) {
crc ^= *data++;
for (int i = 0; i < 8; i++)
crc = (crc & 0x80) ? (crc << 1) ^ 0x07 : crc << 1;
}
return crc;
}Reflected variants such as CRC-8/MAXIM shift the other way and use the bit-reversed polynomial (0x8C for 0x31):
uint8_t crc8_maxim(const uint8_t *data, size_t len)
{
uint8_t crc = 0x00;
while (len--) {
crc ^= *data++;
for (int i = 0; i < 8; i++)
crc = (crc & 1) ? (crc >> 1) ^ 0x8C : crc >> 1;
}
return crc;
}The calculator above generates the matching C, Python and JavaScript for whichever variant is selected.
Test vectors
| Input | Variant | CRC |
|---|---|---|
BE EF (hex) | CRC-8/NRSC-5 (Sensirion) | 92 |
hello | CRC-8 | 92 |
hello | CRC-8/MAXIM | 13 |
hello | CRC-8/SAE-J1850 | A9 |
Other widths
For longer frames use a wider check: the CRC16 calculator covers CCITT, MODBUS and XMODEM, the CRC32 calculator covers CRC-32 and CRC-32C, and the CRC64 calculator covers the 64-bit variants. If your protocol uses a plain sum or XOR instead of a CRC, try the checksum calculator.
Frequently asked questions
Which CRC8 polynomial is the standard one?
There is no single standard. The plain "CRC-8" uses polynomial 0x07 with initial value 0 and no reflection; it is the SMBus packet error code and is also called CRC-8/ATM or CRC-8/CCITT. Dallas/Maxim 1-Wire devices use 0x31 reflected, and automotive systems use 0x1D (SAE J1850) or 0x2F (AUTOSAR). Check your datasheet for the polynomial and the initial value.
What is the CRC8 of "123456789"?
It depends on the variant: 0xF4 for plain CRC-8, 0xA1 for CRC-8/MAXIM, 0x4B for CRC-8/SAE-J1850, 0xDF for CRC-8/AUTOSAR and 0xD0 for CRC-8/ROHC. These check values are the fastest way to confirm which variant a piece of code implements.
How do I calculate the CRC for a Sensirion SHT3x or SCD4x sensor?
Sensirion sensors use polynomial 0x31, initial value 0xFF, no reflection and no final XOR — listed here as CRC-8/NRSC-5. The datasheet test vector is the two bytes BE EF, which give 0x92. Each 16-bit word read from the sensor is followed by its own CRC byte.
What is the difference between polynomial 0x31 and 0x8C?
They are the same polynomial written in opposite bit orders: 0x8C is 0x31 reflected. Code that shifts right, as 1-Wire implementations do, stores it as 0x8C. Likewise 0xE0 is the reflected form of 0x07.
How reliable is an 8-bit CRC?
It detects every single-bit error and every burst up to 8 bits long, and lets about 1 in 256 of other corruptions through. That is fine for a few bytes on a short bus, which is where CRC-8 is used. For longer messages use CRC-16 or CRC-32.