XOR checksum example
XOR combines each byte with bitwise exclusive-or. For 01 02 03 04, the XOR checksum is 0x04.
01 XOR 02 XOR 03 XOR 04 = 04
Compute common lightweight checksums for frames and payloads: XOR, SUM, and LRC. Input can be HEX bytes or text (UTF-8). Everything runs locally in your browser.
Use these short examples to verify an XOR checksum calculator, SUM checksum calculator, or LRC checksum calculator for a serial packet checksum.
XOR combines each byte with bitwise exclusive-or. For 01 02 03 04, the XOR checksum is 0x04.
01 XOR 02 XOR 03 XOR 04 = 04
SUM adds all bytes and masks the result to the selected width. With 8-bit SUM, 01 02 03 04 produces 0x0A.
01 + 02 + 03 + 04 = 0A
LRC uses the 8-bit two's complement of the SUM value. When the SUM is 0x0A, the LRC is 0xF6.
LRC = (-0x0A) & 0xFF = 0xF6
A checksum is a lightweight arithmetic integrity check. CRC uses polynomial division and is usually stronger for detecting transmission errors, so the right choice depends on the protocol.
A checksum calculator takes bytes or text and returns a small value that can be used to check whether a frame, packet, or payload changed.
XOR combines bytes with bitwise exclusive-or, SUM adds bytes and masks the result to a fixed width, and LRC stores the two's complement of an 8-bit sum.
No. A checksum is usually a simpler arithmetic check, while a CRC uses polynomial division and usually detects more transmission errors.
Modbus RTU Frame Decoder · Modbus Function Codes · Modbus RTU Timing · CRC Calculator · HEX ⇄ ASCII ⇄ Binary · UART Packet Time