Ambimat GroupAmbimatAmbiSecureSIMAuthAmbiAutomationEngineering BlogAhmedabad · India · Est. 1981
Crypto & integrity

LRC Calculator

Compute a longitudinal redundancy check over text or hex bytes: XOR parity, 8-bit and 16-bit additive two’s-complement and modulo sums, with optional STX/ETX framing and a step-by-step running-accumulator table.

Client-sideSerial / ISO 8583 / Modbus ASCIIXOR & additive

Input

Result

Enter text or hex bytes to compute an LRC.
All LRC computation runs locally in your browser. Nothing is uploaded — safe for protocol captures and frame dumps.

What an LRC is for

A longitudinal redundancy check (LRC) is one of the oldest and simplest block-check values in data communications. You combine every byte of a message into a single one- or two-byte result, append it to the frame, and let the receiver recompute the same value. If the two disagree, the frame is corrupt and gets rejected or retransmitted. The name "longitudinal" comes from the original tape and teleprinter use: where a parity bit checks one character vertically, the LRC checks a whole column of characters lengthwise down the message.

The classic LRC is a byte-wise XOR of every covered byte — a longitudinal parity that flips with any single-bit change in a column. A second family is additive: sum the bytes and keep either the raw sum modulo 256 (or 65536), or its two’s-complement. The two’s-complement form is popular because adding it back into the running sum drives the total to zero, so a verifier just sums the data and the LRC and checks for a clean zero result.

When to use it

Reach for an LRC when a wire protocol explicitly specifies one. The XOR form appears in many proprietary serial links, point-of-sale terminals, and barcode framing. The two’s-complement additive form is the block check in ISO 8583-style financial messaging and in Modbus ASCII, where each frame ends with an LRC computed over the address, function, and data fields. If your protocol instead calls for polynomial integrity, you want a CRC, not an LRC — for example Modbus RTU uses a 16-bit CRC while Modbus ASCII uses this LRC. Use this tool to confirm a captured frame’s trailing byte, to generate the check value when hand-building a test frame, or to settle which bytes a vendor’s spec actually covers.

Input and output

Paste the message body as ASCII / UTF-8 text or as hex bytes (spaces, commas, colons and a leading 0x are ignored). Pick a variant, then toggle whether the leading STX (0x02) and trailing ETX (0x03) framing bytes are included in the computation — protocols differ, and this is the most common source of mismatches. The result panel shows the LRC in hexadecimal and decimal, the exact list of bytes that were processed, and a running-accumulator table listing each offset, byte value, printable character, and the accumulator after that step. For long inputs the table is capped to keep the page responsive; the final value is always exact.

Common mistakes

Related tools

Hex ↔ bytes

Normalise, group, and inspect the raw bytes you are checking.

Open Hex ↔ bytes →

ASCII ↔ HEX

Convert between printable text and byte values before computing an LRC.

Open ASCII ↔ HEX →

More utilities

Parsers, decoders, and integrity tools for smart-card and protocol engineers.

All resources →