Modbus RTU vs Modbus TCP: The Differences That Actually Matter

Frame structure, timing, error handling and port numbers compared side by side — plus which one to choose for a new project and how gateways bridge the two.

Modbus RTU and Modbus TCP carry the same PDU — the same function codes, the same register tables, the same exception codes. Everything below the PDU is different. That is why a working RTU register map usually transfers to TCP unchanged, while everything about the transport does not.

Side-by-side

Modbus RTUModbus TCP
Physical layerRS-485 (sometimes RS-232)Ethernet
AddressingSlave ID 1–247Unit ID in MBAP header (essentially cosmetic)
Error detectionCRC-16, computed over the whole frameNone — TCP handles integrity
Framing3.5 character silent intervalMBAP header with explicit length
Default portn/a502
Max devices per segment32 unit loads (247 with repeaters)Limited by network, not protocol
Typical latencyMilliseconds to tens of millisecondsSub-millisecond on LAN
Distance1200 m at low baud ratesNetwork-dependent
Concurrent connectionsOne master, sequential pollingMany clients, concurrent

The frames

Identical request — read 10 holding registers starting at address 0, slave 1.

Modbus RTU (8 bytes):

01 03 00 00 00 0A C5 CD
^^ ^^ ^^^^^ ^^^^^ ^^^^^
ID FC  addr  qty   CRC

Modbus TCP (12 bytes):

00 01 00 00 00 06 01 03 00 00 00 0A
^^^^^ ^^^^^ ^^^^^ ^^ ^^^^^^^^^^^^^^^^^
 txn  proto  len  unit     PDU (identical)

Four observations that save real debugging time:

  1. The PDU is byte-for-byte identical. 03 00 00 00 0A appears in both. Only the envelope changed.
  2. The CRC is gone. Do not compute one for TCP. If your code appends a CRC to a TCP frame, the server reads those two bytes as the start of the next request and the connection desynchronises.
  3. proto is always 0x0000. A non-zero value means the frame is not Modbus.
  4. len counts the bytes after itself — unit ID plus PDU. In this example, 6.

Timing: the real difference

RTU has no length field, so it relies on silence to find frame boundaries. The standard says 3.5 character times at the configured baud rate. At 9600 baud with 11 bits per character that is roughly 4 ms.

This has two consequences:

TCP replaces silence with an explicit length, so frames can arrive in any number of TCP segments and still be reassembled correctly. That is the structural reason TCP is easier to implement.

Addressing: where the slave ID goes

In RTU, the slave ID is the first byte and the device genuinely filters on it. Address 0 is the broadcast address — every slave acts, none replies.

In TCP, the unit ID in the MBAP header is often ignored. A direct-to-Ethernet device usually accepts any value. Its purpose appears when a gateway sits in the middle: the unit ID tells the gateway which RS-485 slave the request is for. Setting unit ID 1 when your target is slave 17 behind a gateway produces either no reply or exception 0x0B.

When to choose which

Choose Modbus TCP when: you are building something new, the devices are on Ethernet, you need multiple clients, or you want to debug with Wireshark. A plain TCP connection is dramatically easier to troubleshoot than a shared serial bus.

Choose Modbus RTU when: the sensor only exists with RS-485 (extremely common for power meters, VFDs, temperature controllers, and battery management systems), the run is long, or the environment is electrically noisy. RS-485 differential signalling survives conditions that would corrupt Ethernet.

In practice most installations are both: RTU devices on a serial segment, a gateway or an industrial PC converting to TCP, and the SCADA layer speaking TCP. The gateway is where nearly all integration bugs live.

Gateway troubleshooting checklist

When RTU works locally but not through a gateway:

  1. Confirm the gateway's downstream settings — baud rate, parity, stop bits. These must match the RTU device exactly. A parity mismatch is silent: no reply, no exception.
  2. Confirm the unit ID mapping. Many gateways map unit ID to a specific serial port or slave. Unit ID 1 on a gateway configured for 17 is a dead end.
  3. Check the gateway's request timeout. A slow RTU device answered after 500 ms will look "offline" to a gateway timing out at 300 ms.
  4. Test the RTU side independently. Connect a USB-RS485 adapter directly to the device. If that fails too, the gateway was never the problem.

You can practise both ends on ModbusLab: the TCP slave accepts real connections on port 502, and the message lab lets you encode the same PDU as RTU, ASCII, or TCP and compare the three frames byte by byte.