Modbus TCP vs RTU
What is different, how each is wired, and which one to choose
Quick answer: Modbus TCP and RTU share the same data model and function codes; only the transport differs. RTU runs over RS-485 or RS-232 serial with a slave address and CRC-16, typically up to 115,200 baud. TCP runs over Ethernet on port 502, replaces the CRC with a 7-byte MBAP header and supports multiple clients. Two hybrids are also common: RTU-over-TCP (RTU frames with CRC tunnelled through a TCP socket) and Modbus UDP (the TCP frame sent as UDP datagrams).
Modbus comes in two variants you will meet constantly in the field: Modbus RTU over serial and Modbus TCP/IP over Ethernet. They carry the same data model - coils, discrete inputs, input registers and holding registers - and the same function codes. What differs is the transport: how the message is framed and physically moved between devices.
Is the data different between Modbus TCP and RTU?
Both variants use the same Protocol Data Unit (PDU): a function code plus data. A master reads or writes the same registers either way. So if you can talk to a device over RTU, the register map is identical over TCP - only the connection changes.
How do Modbus TCP and RTU frames differ?
Modbus RTU wraps the PDU with a 1-byte slave address at the front and a 2-byte CRC checksum at the end. Message boundaries are detected by silent gaps on the wire (about 3.5 character times).
Modbus TCP drops the CRC (TCP/IP already guarantees integrity) and adds a 7-byte MBAP header containing a transaction ID, protocol ID, length and unit ID. The unit ID replaces the RTU slave address and is often used when bridging to serial devices through a gateway.
| Aspect | Modbus RTU | Modbus TCP/IP |
|---|---|---|
| Physical layer | RS-485 / RS-232 | Ethernet |
| Topology | Multi-drop bus (daisy chain) | Star (switch) |
| Speed | Up to 115,200 baud | 10/100/1000 Mbps |
| Max devices | Up to 247 on a bus | Effectively unlimited |
| Distance | Up to ~1,200 m (RS-485) | ~100 m per segment |
| Error check | CRC-16 | TCP/IP |
| Masters | One master per bus | Multiple clients |
| Default port | Serial COM port | TCP 502 |
What is Modbus RTU over TCP?
RTU-over-TCP (sometimes called "RTU encapsulated" or "raw" mode) sends the complete RTU frame - slave address, PDU and CRC-16 - inside a plain TCP connection, with no MBAP header. You meet it on serial device servers and gateways that run in transparent mode: the gateway copies bytes between the TCP socket and the RS-485 port without converting them. A true Modbus TCP gateway is different: it receives MBAP-framed Modbus TCP, converts it to RTU and uses the MBAP unit ID as the serial slave address.
If a gateway accepts the TCP connection but never answers Modbus TCP requests, check its operating mode. A transparent gateway needs RTU-over-TCP, and a Modbus TCP gateway needs Modbus TCP. The port is set in the gateway (often 502, 4001 or similar).
What is Modbus UDP?
Modbus UDP uses the same MBAP header and PDU as Modbus TCP but sends each request and response as a UDP datagram, usually on port 502. It has no connection set-up, so it suits some embedded devices and high-rate polling on reliable LANs. However, UDP does not retransmit lost packets, so the master's timeout and retries must deal with any loss.
| Transport | Framing | Carrier | Typical use |
|---|---|---|---|
| Modbus RTU | Address + PDU + CRC-16 | RS-485 / RS-232 | Meters, drives and sensors on a serial bus |
| Modbus ASCII | ':' + hex text + LRC + CR LF | RS-485 / RS-232 | Older or text-based serial devices |
| Modbus TCP | MBAP header + PDU | TCP (port 502) | Ethernet devices, PLCs, SCADA, Modbus TCP gateways |
| RTU-over-TCP | Address + PDU + CRC-16 | TCP socket | Transparent serial device servers |
| Modbus UDP | MBAP header + PDU | UDP (port 502) | Some embedded devices and LAN polling |
How is Modbus RTU wired compared with TCP?
RTU almost always runs on RS-485, a two-wire (plus common) differential bus that lets many devices share one pair of wires over long distances. Terminate both ends with 120 Ω resistors and keep a consistent A/B polarity. TCP runs on ordinary Ethernet cabling to a switch - simpler to wire, but each device needs an IP address.
Should you use Modbus TCP or RTU?
- Choose RTU for simple, cost-sensitive, long-distance runs with a handful of serial devices - meters, drives and sensors on an RS-485 trunk.
- Choose TCP when you already have an Ethernet network, need higher throughput, want multiple clients, or are integrating with SCADA and IT systems.
- Mixed sites are common: a Modbus TCP-to-RTU gateway lets an Ethernet master reach serial devices using the unit ID.
Test both in minutes
ModbusBB 2.0 connects over Modbus TCP, UDP, RTU, ASCII and RTU-over-TCP. It can keep several connections open at once, each with its own poll tabs, so a TCP PLC and an RS-485 meter bus can be tested side by side. Its built-in simulator listens on TCP, UDP, RTU or ASCII. From the CLI, pick the transport with --tcp, --udp, --rtu-over-tcp, --rtu or --ascii:
ModbusBB.CLI read --rtu-over-tcp 10.0.0.5:4001 --unit 3 --address 0 --count 10Frequently asked questions
Is Modbus TCP faster than Modbus RTU?
Usually. Ethernet runs at 10/100/1000 Mbps while RTU serial links typically run at 9,600 to 115,200 baud, and TCP clients can talk to many devices in parallel. In practice, device response time and polling design often matter more than raw link speed.
Can a Modbus TCP master talk to Modbus RTU devices?
Yes, through a Modbus TCP-to-RTU gateway. The master sends Modbus TCP to the gateway, and the Unit ID in the MBAP header selects the downstream RTU slave address. If the gateway runs in transparent mode instead, use RTU-over-TCP.
What port does Modbus TCP use?
TCP port 502 is the registered default. Some devices and gateways are configured to use a different port, so confirm it in the device settings.
What is the difference between Modbus TCP and RTU over TCP?
Modbus TCP uses a 7-byte MBAP header and no CRC. RTU over TCP sends the unchanged RTU frame (slave address, PDU and CRC-16) through a TCP socket, as used by transparent serial device servers. The master must use the mode that the gateway expects.
Does Modbus work over UDP?
Yes. Modbus UDP sends the Modbus TCP frame (MBAP header plus PDU) as UDP datagrams, usually on port 502. UDP does not retransmit lost packets, so the master relies on its timeout and retries.
Keep Learning
Next: how 32-bit values span two registers and why byte order matters.