What Is the Modbus CRC-16 Checksum?
The CRC-16 is the two-byte cyclic redundancy check that ends every Modbus RTU frame and lets a receiver detect corruption on a serial line. Anyone reading an RTU capture or debugging why a device ignores a request needs to know what the CRC covers, how the receiver uses it, and why it disappears on TCP. This reference explains the Modbus RTU CRC without asking you to implement the polynomial by hand.
Modbus CRC-16 Checksum in one line: The Modbus CRC-16 is a two-byte cyclic redundancy check appended to every RTU frame. The transmitter computes it over the slave address, function code, and data; the receiver recomputes it and compares. If they differ the frame was corrupted on the wire and the receiver silently discards it, with no error reply. It appears only in RTU, not in ASCII or TCP.
What the CRC Covers and How It Is Checked
In Modbus RTU the CRC-16 is the last two bytes of the frame. The transmitter runs a cyclic redundancy calculation over every byte before it, the slave address, the function code, and all the data, and appends the resulting sixteen-bit value, low byte first, which is a quirk worth remembering since most Modbus multi-byte fields are high byte first. The receiver runs the identical calculation over the bytes it received and compares its result to the CRC it was sent.
If the two match, the frame is accepted as intact; if they differ, the receiver concludes the frame was corrupted in transit and discards it silently. There is no negative acknowledgment, which is important: a CRC failure looks to the master exactly like no reply at all. This is why line-noise problems present as timeouts rather than explicit errors, a symptom pattern that overlaps with the timing issues in the Modbus serial response delay reference.
Why the CRC Exists and Where It Does Not
The CRC exists because a serial line is an unprotected channel where electrical noise, reflections from bad termination, or a marginal transceiver can flip bits. A two-byte CRC catches the burst errors typical of such faults far more reliably than a simple checksum would, which is why RTU uses a CRC while the older ASCII mode uses a weaker longitudinal redundancy check, a contrast drawn in the Modbus RTU vs ASCII transmission mode reference.
Modbus TCP has no CRC at all. The MBAP-headered TCP frame relies on TCP's own checksums and reliable delivery, so a Modbus-level CRC would be redundant, as the Modbus TCP vs RTU comparison explains. The CRC is therefore a serial-RTU-only feature, and its absence is one of the quick tells that distinguishes an RTU capture from a TCP one.
The Algorithm Parameters, Fixed by the Specification
You rarely need to implement the CRC yourself, but knowing its fixed parameters helps when a library or a protocol analyzer gives a result you did not expect. The Modbus RTU CRC uses the generator polynomial x^16 + x^15 + x^2 + 1, written 0x8005, and virtually every implementation processes it in reflected form using the constant 0xA001. The register is seeded with 0xFFFF, there is no final XOR, and the result goes onto the wire low byte first. All of this is fixed by the Modbus over serial line specification, so any two conforming implementations must produce identical values for the same bytes - if yours disagrees with a known-good tool, one of these parameters is set wrong.
| Parameter | Value in Modbus RTU |
|---|---|
| Polynomial | x^16 + x^15 + x^2 + 1 (0x8005) |
| Working constant (reflected form) | 0xA001 |
| Initial register value | 0xFFFF |
| Final XOR | None |
| Byte order in the frame | Low byte first |
| Coverage | Address through the last data byte |
Checking a Frame by Hand: A Worked Example
Suppose a capture shows a request of six bytes followed by two more: address, function code, starting-address high and low, quantity high and low, then two trailing bytes. To verify it, feed the first six bytes to any Modbus CRC-16 routine or calculator configured per the table above and compare the sixteen-bit result to the trailing pair. Remember the order: the first trailing byte on the wire is the low byte of the computed value and the second is the high byte. If your computed value matches only when you swap the two bytes, nothing is corrupted - your tool is printing the value high byte first while the wire carries it low byte first, which is the single most common source of false alarm when checking frames manually.
If the value does not match in either order, there are two possibilities: the frame really was corrupted, or your capture stitched together bytes from two different frames. The second case happens when the silent interval between frames shrinks below the specification's 3.5 character times and the capture tool, or the receiver itself, can no longer tell where one frame ends and the next begins. A frame boundary error and a corrupted frame look identical from the CRC's point of view, so when hand-checks keep failing on frames that devices are apparently accepting, suspect your capture setup before the wire.
Diagnosing a Line That Fails CRC Repeatedly
Occasional CRC failures on a long serial run in an electrically noisy plant are unremarkable; a rising or constant failure rate is a wiring problem wearing a protocol costume. Work through the physical layer in a fixed order rather than jumping to conclusions:
- Confirm both ends of the RS-485 segment are terminated, and that no mid-span device has its termination resistor switched in.
- Check biasing so the line idles in a defined state - an undefined idle produces garbage bytes at frame boundaries that fail CRC.
- Verify every device agrees on baud rate, parity, and stop bits; a settings mismatch corrupts every frame, not just some of them.
- Inspect shield grounding and reroute cable away from variable frequency drives and power conductors.
- Swap or reseat suspect transceivers and connectors last, once the cabling checks clean.
Because a failed CRC is discarded silently, the master's statistics are your instrument: watch the timeout and retry counters per device. One device failing while its neighbors stay clean points at that drop's stub, connector, or transceiver; every device failing points at the trunk, the master's own port, or shared timing. A gateway that polls the serial network and publishes data upstream will usually expose these counters, which is worth checking before dispatching anyone to site, as covered in the guide to connecting Modbus devices to cloud SCADA.
What the CRC Does and Does Not Guarantee
The CRC tells you the bytes arrived as sent; it does not tell you they came from the right device or that they mean what you think. If two devices are misconfigured onto the same address, both replies carry perfectly valid CRCs while the data is wrong. A frame with a valid CRC can still be rejected at the application layer with a Modbus exception code if its function or address is invalid. And like any sixteen-bit check, the CRC is probabilistic: it is extremely good at catching the burst errors serial lines actually produce, but it is a detection mechanism, not a mathematical guarantee. That residual uncertainty is one reason important write commands should be confirmed by reading the value back rather than trusting a clean exchange alone.
Frequently Asked Questions
What happens when a Modbus CRC check fails?
The receiver silently discards the frame with no reply. There is no negative acknowledgment in Modbus RTU, so a CRC failure looks identical to no response at all from the master's side. That is why line-noise and termination problems typically show up as timeouts rather than as explicit error messages.
What bytes does the Modbus CRC cover?
Every byte of the frame before the CRC itself: the slave address, the function code, and all of the data. The two CRC bytes are then appended, low byte first, unlike most Modbus multi-byte fields which are high byte first. The receiver recomputes the CRC over the same bytes and compares.
Why is there no CRC in Modbus TCP?
Because TCP already provides its own checksums and guarantees reliable, ordered delivery, a Modbus-level CRC would add nothing. TCP frames carry an MBAP header instead of a serial address and CRC. The CRC-16 is therefore unique to serial RTU; ASCII uses an LRC and TCP uses no Modbus-level checksum at all.
Do I ever need to compute the Modbus CRC myself?
Almost never. Every Modbus library, PLC driver, and protocol analyzer computes and checks it automatically, and gateways regenerate it whenever they rebuild frames. The times you touch it directly are validating a raw capture by hand, implementing Modbus on a bare microcontroller, or debugging a homegrown driver that gets no replies - the classic cause in that last case being a correct CRC appended high byte first instead of low byte first.
Does a Modbus TCP gateway recalculate the CRC?
Yes. A gateway bridging TCP to RTU strips the MBAP header, builds a fresh serial frame, and computes a new CRC for it; in the other direction it verifies the serial CRC before forwarding the payload over TCP. The CRC therefore only ever protects the serial hop. Corruption inside the gateway itself, though rare, would not be caught by either check, which is another argument for reading back any write that matters.
Sources and verification
This page references the protocol specifications published by the organizations below. Editions, product capabilities, and documentation change over time - confirm current requirements and specifications directly with the source.
- Modbus Application Protocol Specification - Modbus Organization
Merobix is not affiliated with, endorsed by, or sponsored by these organizations; their names are used only to identify the standards and products discussed.
Automation services
Need help turning this into a working system?
Merobix integrates SCADA, programs Allen-Bradley and Siemens PLCs, and designs and fabricates industrial control panels.
Meeting requests are reviewed before confirmation.