TestBench.tools

CRC-16 CCITT Calculator

CRC-16/CCITT-FALSE and related variants, selectable parameters.

9 bytes

CRC-16/CCITT-FALSE
0x29B1
Bytes (little-endian)
B1 29
Bytes (big-endian)
29 B1
Decimal
10673

This tool computes the CCITT family of 16-bit CRCs — every variant built on polynomial 0x1021. Pick the variant your protocol uses (CCITT-FALSE, XMODEM, KERMIT or IBM-SDLC) and the result updates live. Reference check values over ASCII 123456789: CCITT-FALSE 0x29B1, XMODEM 0x31C3, KERMIT 0x2189, IBM-SDLC 0x906E.

How it works

All four variants divide the message by the generator polynomial 0x1021 (x¹⁶ + x¹² + x⁵ + 1) and keep the 16-bit remainder, but they differ in three model parameters. CCITT-FALSE and XMODEM process bits most-significant first (no reflection) and differ only in the initial register value — 0xFFFF versus 0x0000. KERMIT and IBM-SDLC reflect the bit order; IBM-SDLC additionally starts from 0xFFFF and inverts the final remainder.

Because the parameter model — not the polynomial — determines the result, always confirm a variant against a known check value before trusting an integration.

Worked example

input (ASCII)   : 123456789
CCITT-FALSE    : 0x29B1
XMODEM         : 0x31C3
KERMIT         : 0x2189
IBM-SDLC       : 0x906E

Parameters

ParameterValueNotes
CRC-16/CCITT-FALSEinit 0xFFFF · no reflect · xorout 0x0000check 0x29B1
CRC-16/XMODEMinit 0x0000 · no reflect · xorout 0x0000check 0x31C3
CRC-16/KERMITinit 0x0000 · reflected · xorout 0x0000check 0x2189
CRC-16/IBM-SDLCinit 0xFFFF · reflected · xorout 0xFFFFcheck 0x906E
Polynomial (all)0x1021

C implementation

C
#include <stdint.h>
#include <stddef.h>

/* CRC-16/CCITT-FALSE: poly 0x1021, init 0xFFFF,
 * no reflection, no final XOR. */
uint16_t crc16_ccitt_false(const uint8_t *data, size_t len)
{
    uint16_t crc = 0xFFFF;
    for (size_t i = 0; i < len; i++) {
        crc ^= (uint16_t)data[i] << 8;
        for (int b = 0; b < 8; b++)
            crc = (crc & 0x8000) ? (crc << 1) ^ 0x1021 : crc << 1;
    }
    return crc; /* "123456789" -> 0x29B1 */
}

FAQ

Which variant is “the” CRC-CCITT?

There is no single one — that is why this page has a variant selector. All four share polynomial 0x1021 but differ in init, reflection and final XOR. CCITT-FALSE (init 0xFFFF, no reflection) is what most people mean; XMODEM starts from 0x0000; KERMIT reflects; IBM-SDLC (X.25) reflects and inverts the result.

What are the check values for each variant?

Over the ASCII string 123456789: CCITT-FALSE → 0x29B1, XMODEM → 0x31C3, KERMIT → 0x2189, IBM-SDLC → 0x906E. All four are pinned in this site's automated test suite.

My device documentation just says “CRC-CCITT 0x1021” — which variant do I pick?

Compute your device's CRC over the string 123456789 (or any frame you already trust) and compare against each variant's result here. Matching the check value identifies the exact model; the CRC Identifier tool automates this search.

Why does the same polynomial give four different results?

The CRC value depends on the full parameter model, not the polynomial alone: the initial register value, whether input/output bits are reflected, and the final XOR all change the result.

Is my data uploaded?

No. Everything is computed locally in your browser.

Related tools