LRC Modbus ASCII Utility

Modbus ASCII Frame & LRC Calculator

Use this Modbus ASCII Frame & LRC Calculator to build complete Modbus ASCII requests, calculate the Longitudinal Redundancy Check (LRC), validate captured ASCII messages and decode slave address, function code, register or coil address, quantity, values and exception responses.

✓ LRC Calculator ✓ ASCII Frame Builder ✓ LRC Validator ✓ Register Decoder ✓ Exception Decoder
:…
Build / Decode Modbus ASCII
● Ready
Addresses 1–247 are normal unicast slaves. Address 0 is broadcast.
Select the request function to encode.
16-bit protocol address in hexadecimal.
Number of registers to read.
Modbus ASCII framing: A frame starts with a colon :, represents every binary byte as two hexadecimal ASCII characters, places the one-byte LRC immediately before the end, and terminates with carriage return + line feed (CR LF).
Modbus ASCII Result Valid
Generated ASCII Frame
Slave Address
Function
Start Address
Quantity / Value
LRC
LRC Status
Binary Bytes
ASCII Characters
LRC & Frame Breakdown -
Complete ASCII Frame
-

What Is a Modbus ASCII Frame & LRC Calculator?

A Modbus ASCII Frame & LRC Calculator creates and validates the ASCII serial representation of a Modbus message. Unlike Modbus RTU, which sends message bytes directly in binary form, Modbus ASCII converts every message byte into two readable hexadecimal characters.

The mode also uses a one-byte Longitudinal Redundancy Check rather than the 16-bit CRC used by RTU. This makes captured messages relatively easy to inspect with a terminal or serial monitor.

The calculator builds common read and write requests, generates the correct LRC, shows the complete colon-delimited frame and can decode an existing ASCII message back into its binary Modbus fields.

Modbus ASCII Frame Format

The Modbus Serial Line specification defines a recognizable beginning and end for each ASCII message.

: Address Function Data LRC CR LF

The frame starts with an ASCII colon character. Message bytes are represented using hexadecimal characters 0–9 and A–F. The normal frame terminator is the carriage-return / line-feed pair. :contentReference[oaicite:2]{index=2}

What Is the Modbus LRC?

LRC means Longitudinal Redundancy Check. In Modbus ASCII it provides the message-level error check.

The LRC occupies one binary byte, which is represented by two hexadecimal ASCII characters when inserted into the transmitted ASCII frame.

The colon character and terminating CR/LF characters are not included in the LRC calculation. The LRC is calculated on the binary message bytes before those bytes are converted to their hexadecimal ASCII representation.

This behavior is explicitly defined by the Modbus Serial Line specification. :contentReference[oaicite:3]{index=3}

How to Calculate Modbus ASCII LRC

Take the binary message bytes

Include slave address, function code and all data bytes, but not the LRC itself.

Add the 8-bit bytes

Sum every byte in the message.

Discard carries

Keep only the least-significant eight bits of the sum.

Take the two’s complement

Negate the 8-bit sum modulo 256 to produce the LRC.

Convert the LRC to two hex characters

Append those characters immediately before the ending CR/LF.

Modbus ASCII LRC Formula

For message bytes: B1, B2, B3 … Bn First calculate: SUM = (B1 + B2 + B3 + … + Bn) & 0xFF Then: LRC = (-SUM) & 0xFF Equivalent: LRC = ((~SUM) + 1) & 0xFF

This is the two’s-complement method described by the Modbus specification. :contentReference[oaicite:4]{index=4}

Modbus ASCII LRC Example

Consider a request to slave 1 using function 03 to read ten holding registers starting at protocol address zero.

Binary bytes: 01 03 00 00 00 0A Sum: 0x01 + 0x03 + 0x00 + 0x00 + 0x00 + 0x0A = 0x0E Two’s complement: -0x0E mod 256 = 0xF2 LRC: F2 ASCII frame: :01030000000AF2<CR><LF>

Modbus ASCII vs Modbus RTU

Feature Modbus ASCII Modbus RTU
Message representation Hexadecimal ASCII characters Binary bytes
Start marker Colon : Timing-based
End marker CR LF Silent interval
Error check 8-bit LRC 16-bit CRC
Characters per message byte 2 ASCII hex characters 1 binary byte
Human readability Higher Lower

Because every binary byte becomes two ASCII hexadecimal characters, ASCII mode requires more transmitted characters than RTU for equivalent Modbus message content. :contentReference[oaicite:5]{index=5}

Modbus ASCII Function 03 Example

Request fields: Slave = 01 Function = 03 Start = 0000 Quantity = 000A Binary message: 01 03 00 00 00 0A LRC: F2 Final ASCII text: :01030000000AF2<CR><LF>

Supported Function Codes

Hex Function Purpose
01 Read Coils Read one or more coil states
02 Read Discrete Inputs Read discrete input states
03 Read Holding Registers Read 16-bit holding registers
04 Read Input Registers Read 16-bit input registers
05 Write Single Coil Write one coil
06 Write Single Register Write one holding register
0F Write Multiple Coils Write multiple packed coil states
10 Write Multiple Registers Write multiple holding registers

Function 06 Modbus ASCII Example

Suppose slave 1 writes value 3 into protocol register address 1.

Binary bytes before LRC: 01 06 00 01 00 03 LRC: F5 Complete ASCII frame: :010600010003F5<CR><LF>

Modbus ASCII Character Encoding

Each 8-bit Modbus message byte becomes two ASCII hexadecimal characters.

Binary byte: 0x3A Hexadecimal text representation: “3A” ASCII character codes: ‘3’ = 0x33 ‘A’ = 0x41

The LRC is calculated from the binary byte value 0x3A, not from the ASCII codes 0x33 and 0x41 used to transmit the textual representation.

Colon Start Character

A normal Modbus ASCII frame begins with the colon character:

: ASCII hexadecimal code: 0x3A

Receivers monitor the serial stream for this character to identify the start of a new ASCII message. :contentReference[oaicite:6]{index=6}

CR LF End of Frame

The standard end-of-frame sequence is:

CR LF ASCII codes: CR = 0x0D LF = 0x0A

These terminator characters are not included in the LRC calculation. :contentReference[oaicite:7]{index=7}

How to Validate a Modbus ASCII LRC

When an existing frame is decoded, the calculator treats the final binary byte before CR/LF as the received LRC.

For: :01030000000AF2 Binary contents: 01 03 00 00 00 0A F2 Received LRC: F2 Recalculated from: 01 03 00 00 00 0A Expected: F2 Therefore: LRC VALID

Modbus ASCII Exception Responses

Exception handling follows the normal Modbus application protocol principle. The server sets the high bit of the requested function code and follows it with an exception code.

Request function: 03 Exception function: 83 Example binary response content: 01 83 02 LRC: 7A ASCII frame: :0183027A<CR><LF>

Common Modbus Exception Codes

Code Meaning
01Illegal Function
02Illegal Data Address
03Illegal Data Value
04Server Device Failure
05Acknowledge
06Server Device Busy
08Memory Parity Error
0AGateway Path Unavailable
0BGateway Target Device Failed to Respond

Why Modbus ASCII Is Slower Than RTU

The application data represented by a single binary RTU byte requires two hexadecimal characters in ASCII mode.

One binary byte: AB RTU transmission: 1 binary byte ASCII representation: ‘A’ ‘B’ = 2 transmitted ASCII characters

Therefore ASCII mode consumes substantially more serial transmission time at the same line speed. :contentReference[oaicite:8]{index=8}

Modbus ASCII Maximum Frame Size

The Modbus Serial Line guide notes that each binary data byte requires two ASCII characters. To remain compatible with the maximum Modbus application data size, the ASCII data field may therefore contain up to twice the corresponding hexadecimal character count.

The guide specifies a maximum Modbus ASCII frame size of 513 characters. :contentReference[oaicite:9]{index=9}

LRC vs CRC

Modbus ASCII LRC

One-byte longitudinal redundancy check calculated using 8-bit addition and two’s complement.

Modbus RTU CRC

Two-byte cyclic redundancy check calculated using the Modbus CRC-16 algorithm.

They are not interchangeable. An RTU CRC should not be appended to an ASCII frame, and an ASCII LRC should not replace the RTU CRC.

Common Modbus ASCII Mistakes

Including Colon in LRC

The start colon is excluded from the LRC calculation.

Including CR/LF in LRC

The ending CR/LF pair is not included in the LRC.

Calculating Over ASCII Codes

LRC is calculated from binary message bytes before hexadecimal character encoding.

Using RTU CRC

ASCII mode uses the one-byte LRC rather than the RTU CRC-16.

Missing Colon

A correctly framed standard ASCII message begins with a colon.

Odd Number of Hex Digits

Every binary message byte must be represented by exactly two hexadecimal characters.

Modbus ASCII Frame & LRC Calculator FAQs

What is Modbus ASCII?
Modbus ASCII is a serial Modbus transmission mode in which each message byte is represented by two hexadecimal ASCII characters.
What character starts a Modbus ASCII frame?
A standard Modbus ASCII frame begins with a colon character (:).
How does a Modbus ASCII frame end?
It normally ends with a carriage-return and line-feed pair, CR LF.
What is LRC in Modbus?
LRC means Longitudinal Redundancy Check. Modbus ASCII uses a one-byte LRC to check the message contents.
How is Modbus LRC calculated?
Add the message bytes modulo 256 and take the two’s complement of the resulting 8-bit sum.
Is the colon included in the LRC?
No. The starting colon is excluded.
Are CR and LF included in the LRC?
No. The terminating CR/LF pair is excluded from the calculation.
Is the received LRC one or two bytes?
The LRC is one binary byte, but ASCII mode represents it using two hexadecimal ASCII characters.
What is the LRC for 01 03 00 00 00 0A?
The LRC is hexadecimal F2, producing the frame :01030000000AF2 followed by CR LF.
What is the difference between LRC and CRC?
Modbus ASCII uses an 8-bit LRC. Modbus RTU uses a 16-bit CRC. The algorithms and transmitted fields are different.
Does Modbus ASCII use hexadecimal?
Yes. Each binary byte is represented by two hexadecimal characters from 0–9 and A–F.
Can Modbus ASCII carry function 03?
Yes. The Modbus application function codes are used in both serial encoding modes; function 03 reads holding registers.
Can this calculator validate an existing LRC?
Yes. Paste the complete hexadecimal ASCII frame and the decoder recalculates the LRC and compares it with the received LRC byte.
Can this tool decode exception responses?
Yes. It detects function codes with bit 7 set and reports common Modbus exception codes.
Why is Modbus ASCII less efficient than RTU?
Each binary data byte requires two hexadecimal ASCII characters, so equivalent messages require more serial characters.
Can spaces appear inside the transmitted Modbus ASCII frame?
The normal transmitted frame contains consecutive hexadecimal characters. The decoder may accept formatting characters for convenience, but they should not be treated as part of the actual standard wire frame.

Build and Validate Modbus ASCII Frames

Create Modbus ASCII read and write requests with the correct LRC, or paste an existing ASCII frame to decode message fields, verify the checksum and inspect function, address, quantity and exception information.

Scroll to Top