Modbus Protocol Parser
Parse, convert, and debug Modbus RTU/ASCII/TCP communications
Please enter input data
Modbus Protocol Reference
Modbus is the most widely used industrial communication protocol, originally developed by Modicon in 1979. It enables communication between electronic devices over serial lines (RTU) or Ethernet (TCP/IP). This tool helps engineers debug and analyze Modbus communications without specialized hardware or software.
Modbus RTU Frame Structure
Modbus RTU (Remote Terminal Unit) transmits data in binary format over serial connections like RS-232 or RS-485. Each frame includes a slave address, function code, data, and a 16-bit CRC checksum for error detection. The compact binary format makes RTU efficient for bandwidth-constrained environments.
1 byte
1 byte
N bytes
2 bytes
Modbus RTU Frame Structure
Modbus TCP Frame Structure
Modbus TCP encapsulates RTU frames within TCP/IP packets, using a 7-byte MBAP (Modbus Application Protocol) header. This header contains a transaction ID for request-response matching, protocol identifier (always 0 for Modbus), message length, and unit ID. TCP communication uses port 502 by default.
2 bytes
2 bytes
2 bytes
1 byte
1 byte
N bytes
Modbus TCP Frame Structure (MBAP Header + PDU)
Common Function Codes
Function codes define the operation type in a Modbus request. Read operations (01-04) retrieve coil states or register values, while write operations (05, 06, 0F, 10) modify device data. Each function code has specific data format requirements.
| Code | Function | Type |
|---|---|---|
| 0x01 | Read Coils | Read |
| 0x02 | Read Discrete Inputs | Read |
| 0x03 | Read Holding Registers | Read |
| 0x04 | Read Input Registers | Read |
| 0x05 | Write Single Coil | Write |
| 0x06 | Write Single Register | Write |
| 0x0F | Write Multiple Coils | Write |
| 0x10 | Write Multiple Registers | Write |
Byte Order in Modbus
Different PLC manufacturers use varying byte orders for 32-bit and 64-bit values. The four common arrangements are: Big Endian (ABCD) - standard network order; Little Endian (DCBA); Mid-Big Endian (BADC); and Mid-Little Endian (CDAB). When reading incorrect values, try different byte orders to find the correct interpretation.
CRC-16/Modbus Algorithm
Modbus RTU uses CRC-16 with polynomial 0x8005 and initial value 0xFFFF for error detection. The CRC is calculated over the slave address, function code, and data bytes, then appended in low-byte-first order. A frame with incorrect CRC should be discarded by the receiver.
Practical Applications
- Troubleshoot communication errors between PLCs and SCADA systems by analyzing raw packet data
- Verify register values during commissioning by converting hex data to engineering units
- Generate test commands for device validation without dedicated Modbus master software
- Debug byte order issues when integrating devices from different manufacturers
Related Tools
CRC Calculator
Calculate CRC-8, CRC-16, CRC-32, CRC-64 checksums with support for Modbus, CCITT and other protocol standards
Online Serial Port Debugger
Browser-based serial debugging tool - no download required, real-time monitoring via Web Serial API
Base Converter
Convert between binary, octal, decimal, and hexadecimal number systems with custom base support (2-36)
Text Encoding Converter
Convert text between Hex, Binary, Unicode, ASCII, Base64, and many other encoding formats