Modbus RTU CRC16 Calculator
Enter your Modbus RTU bytes and instantly compute or verify the CRC-16 checksum (polynomial 0xA001, init 0xFFFF).
01 03 00 00 00 0A, 01,03,00,00,00,0A, 01030000000A, or with 0x prefixes.What is a Modbus RTU CRC calculator?
A Modbus RTU CRC calculator helps you generate and validate the 16-bit cyclic redundancy check used in Modbus serial communication. Every RTU frame ends with a CRC field, and devices use that field to detect line noise, framing issues, or corrupted bytes. If the CRC does not match, the receiving device silently discards the frame.
This tool is useful for embedded engineers, PLC programmers, industrial automation technicians, and anyone debugging RS-485 traffic captures.
Why CRC matters in Modbus RTU
- Reliability: Catches common transmission errors before a bad command is executed.
- Interoperability: Ensures your custom firmware produces standards-compliant frames.
- Debugging speed: Lets you quickly determine whether a communication issue is CRC-related or caused by addressing, timing, or wiring.
- Field diagnostics: Helpful when reading analyzer logs from multi-drop RS-485 networks.
How Modbus RTU CRC16 works
CRC parameters used by Modbus
- Width: 16 bits
- Initial value: 0xFFFF
- Polynomial (reflected): 0xA001
- XOR out: 0x0000
- Byte order on wire: Low byte first, high byte second
Algorithm summary
- Start CRC register at
0xFFFF. - XOR each data byte into the low byte of the CRC register.
- For each bit (8 times per byte), shift right by one.
- If the shifted-out bit was 1, XOR with
0xA001. - After all bytes, append CRC low byte then high byte to the message.
How to use this calculator
- Enter your request or response payload bytes without CRC in the first input box.
- Click Calculate CRC.
- Copy the displayed CRC bytes and append them to your frame in low-high order.
- If you already have a full frame, paste it in the verification box and click Verify CRC.
Worked example
Suppose your request is:
01 03 00 00 00 0A
The calculator returns a CRC of 0xCDC5. In Modbus RTU byte order, this is appended as:
C5 CD
So the complete frame becomes:
01 03 00 00 00 0A C5 CD
Common mistakes that cause CRC mismatches
- Appending CRC in high-low order instead of low-high order.
- Including ASCII characters when your link expects binary RTU bytes.
- Calculating CRC over the wrong subset of bytes (e.g., including start/stop bytes from another protocol wrapper).
- Confusing Modbus TCP framing with Modbus RTU framing.
- Using the wrong initial value or polynomial from a non-Modbus CRC variant.
Practical debugging tips
1) Confirm physical layer quality first
CRC failures can come from cable shielding, improper grounding, missing termination, or baud/parity mismatches. Validate line health before changing software.
2) Verify framing and timing
Modbus RTU uses silent intervals to separate frames. If your transmitter violates inter-frame timing, receivers may parse byte boundaries incorrectly and report CRC failures.
3) Compare device logs and analyzer captures
If the same frame CRC passes in firmware but fails on the wire, inspect the raw serial capture. The issue is often a changed byte, not the algorithm.
Reference implementation (JavaScript)
function modbusCRC(bytes) {
let crc = 0xFFFF;
for (const b of bytes) {
crc ^= b;
for (let i = 0; i < 8; i++) {
if (crc & 0x0001) crc = (crc >> 1) ^ 0xA001;
else crc = crc >> 1;
}
}
return crc & 0xFFFF;
}
FAQ
Is this CRC calculator for Modbus TCP?
No. Modbus TCP uses an MBAP header and does not include the RTU CRC field.
Can I paste bytes with commas or no spaces?
Yes. The parser accepts space-separated, comma-separated, and contiguous hex strings.
Do I include slave address and function code in the CRC calculation?
Yes. Calculate CRC over the entire RTU message from address byte through the final data byte, then append the CRC.