Modbus RTU appends two CRC bytes to a frame. The receiver repeats the calculation and rejects a frame if the values differ. The computation uses one register, XOR operations, and right shifts.
A calculator showing Modbus CRC-16 register changes one bit at a time
1. Enter bytes in hexadecimal, separated by spaces
2. Run the calculation
Next step performs the byte XOR or one of eight shifts. The red outline marks the bit that will shift out next.
Calculation rules
Start with 0xFFFF. For each byte, XOR it into the register's low eight bits, then shift right eight times. After each shift, XOR with 0xA001 only if the bit shifted out was 1.
crc = 0xFFFF
for each byte b:
crc ^= b
repeat 8 times:
if crc & 1: crc = (crc >> 1) ^ 0xA001
else: crc = crc >> 1
0xA001 is the bit-reflected form of polynomial 0x8005. This implementation processes data least-significant-bit first and uses the reflected polynomial accordingly.
Send the low byte first
Modbus appends the low CRC byte before the high byte. A register value of 0xCDC5 is transmitted as C5 CD. Check byte order when diagnosing firmware CRC mismatches.