Modbus CRC-16 calculator

Paste the bytes of a Modbus RTU frame in hex. Without its CRC you get the two bytes to append; with its CRC you find out whether the frame is intact.

How the Modbus CRC works

The algorithm

Modbus RTU uses CRC-16 with the reflected polynomial 0xA001 (0x8005 forward) and an initial value of 0xFFFF, with no final XOR. Each byte is XORed into the register, which is then shifted right eight times, XORed with 0xA001 each time the bit shifted out is a 1.

Byte order on the wire

The CRC is the one place in Modbus that goes low byte first. A CRC of 0x0A84 is sent as 84 0A, which is why a request to read one register at address 0 from device 1 ends in 84 0A.

Checking a captured frame

Run the CRC over the whole frame including its last two bytes. An intact frame gives zero, because the CRC was chosen to cancel itself. Any other result means a byte was lost, added or corrupted on the line.

Frequently asked questions

Why does my device not answer a frame with a correct CRC?

The CRC only proves the frame was received as sent. Check the slave address, the baud rate, parity and stop bits, and the A and B lines, which are easy to swap. A device on a different address ignores the frame silently.

Does Modbus TCP use a CRC?

No. Modbus TCP relies on the checks in TCP and Ethernet and carries an MBAP header instead. The CRC belongs to Modbus RTU on a serial line such as RS485.

What is the CRC of "123456789"?

0x4B37, the standard check value for CRC-16/MODBUS. It is a quick way to confirm that a CRC routine is implemented correctly.

Reading Modbus sensors in the field?

Genesis reads RS485 Modbus sensors, analogue transducers and 1-Wire probes on the same four ports and reports them over cellular. Tell us what you need to read.

Talk to us →