Modbus address converter
Type a register number such as 40001 or 400001 and the page gives the zero-based protocol address, the table it belongs to and the function codes that read and write it. It also works backwards from a protocol address to the 5-digit or 6-digit number.
Calculator
This calculator needs JavaScript. Without it, use the formulas under "How it works" and the worked example.
Register number to protocol address
For example 00001 (coil), 10001, 30001, 40001, or the 6-digit forms 000001, 100001, 300001, 400001. Keep the leading zeros of a coil number.
Protocol address to register number
How it works
The old register notation is a table digit followed by the position in the table counted from 1. The Modbus request carries only the position counted from 0, and the function code picks the table. The conversion in both directions is:
protocol address = notation - (table digit × 10^(digits - 1)) - 1 notation = table digit × 10^(digits - 1) + protocol address + 1
with digits = 5 or 6. The 5-digit form holds 9999 positions per table (x0001 to x9999, addresses 0 to 9998). The 6-digit form covers every 16-bit address (x00001 to x65536, addresses 0 to 65535).
| Notation | Table | Read | Write |
|---|---|---|---|
| 0xxxx / 0xxxxx | Coils | 01 | 05 single, 15 multiple |
| 1xxxx / 1xxxxx | Discrete inputs | 02 | none (read-only) |
| 3xxxx / 3xxxxx | Input registers | 04 | none (read-only) |
| 4xxxx / 4xxxxx | Holding registers | 03 | 06 single, 16 multiple |
Function code 15 is 0x0F and 16 is 0x10 in the frame. The address field of the request is written as two bytes, high byte first.
Worked example
A manual lists a value at holding register 40108.
- The leading 4 selects the holding registers, so the number within the table is 40108 - 40000 = 108.
- The protocol address is 108 - 1 = 107, which is 0x006B in the request.
- The read request uses function code 03 with start address 0x006B; the 6-digit form of the same register is 400108.
A tool that expects the notation number and subtracts for you must be given 40108. A tool that asks for the protocol address must be given 107. Giving 40108 where 107 is wanted asks for protocol address 40108, a different register that most devices refuse with exception 02 (illegal data address). Giving 107 where the notation number is wanted is refused or read as coil 00107, which is a different table.
Common mistakes
- The table digit is not sent on the wire. The function code in the request chooses the table, so 03 reads holding registers and 04 reads input registers at the same address number.
- Register 40001 is address 0. Some tools subtract the 1 and some expect you to. If a read returns the value of the neighbouring register, an off-by-one in this step is the first thing to check.
- Some manuals list the zero-based protocol address (starting at 0 or 0x0000) and others list the register number starting at 1, often in a column that does not say which. Check one known register before trusting the list.
- The 5-digit form stops at x9999, so address 9999 and above cannot be written in it. Larger maps use the 6-digit form, but a 6-digit number is itself a convention that a given manual may or may not follow.
- A 32-bit value takes two consecutive registers, so the next value starts two addresses further on, not one.
Related articles
- Modbus holding register vs input register: which one to use
- Why S7-1500 Modbus RTU input registers come from the IW area
- What CODESYS %IW0 means for a Modbus TCP holding register
- ABB drive to Quantum PLC over Modbus: find the register map
- Why MB_MASTER on an S7-1200 reports Modbus error 16#8188
- Modbus exception 02 when a read crosses a register map gap
- SCADAPack 470 logic values to Modbus TCP registers in RemoteConnect
- Why a TP700 Comfort panel cannot serve Modbus TCP registers