Skip to content
Hex Calculator

Hex Two's Complement Checksum Calculator

Compute a two's-complement checksum: sum the bytes, then take the two's complement of the result — the technique behind Intel HEX and LRC checksums.

Sum checksum (mod 256)
0x9C
Sum, decimal
156
Two's-complement check byte (Intel HEX style)
0x64
Swapnil Sanghvi

Built by

Swapnil Sanghvi

Full-Stack Web Developer & WordPress Developer

Swapnil Sanghvi is a full-stack web and WordPress developer, UI designer, and full-time freelancer who builds and maintains Hex Calculator.

Hex Two's Complement Checksum Calculator tool preview card from Hex Calculator
Share preview: this is the card that appears when you share the Hex Two's Complement Checksum Calculator page on social media.

Further reading: Cyclic redundancy check — Wikipedia

How a Two's-Complement Checksum Works

Add every byte together, keep only the low 8 bits of the total, then take the two's complement — invert every bit, then add 1. That final value is the checksum. This is the same underlying calculation used by Intel HEX files and Modbus ASCII's LRC field.

Where This Technique Actually Comes Up

Intel HEX Record Checksums

Every line of an Intel HEX file, used to program microcontrollers and EPROMs, ends in a checksum byte computed exactly this way — the two's complement of the sum of all preceding bytes on that line.

:10 0000 00 ... checksum

Modbus ASCII's LRC Field

Modbus ASCII mode calls this same two's-complement checksum an LRC (Longitudinal Redundancy Check) and appends it to every message frame for error detection.

frame bytes + LRC checksum

Implementing a Self-Checking Checksum From Scratch

When designing a simple protocol and wanting a checksum where "sum of everything including the checksum equals zero" is easy to verify, the two's-complement technique is a well-established, easy-to-implement choice.

data + checksum sums to 0x00

Why Use This Calculator Instead of Doing It by Hand

  • Shows the intermediate sum alongside the final two's-complement result
  • Accepts space-separated byte lists, matching how hex dumps are usually written
  • Runs entirely in your browser — nothing you type gets sent anywhere
  • Saves manual two's-complement arithmetic on longer byte sequences

Limitations

  • This is an 8-bit additive checksum with a two's-complement finishing step — it won't catch every corruption pattern (like two bytes swapping) the way a CRC would.
  • Some formats compute this over only part of a record (excluding a length or address field) — check your specific format's spec for exactly which bytes to include.

Frequently Asked Questions

What is a two's-complement checksum?

An additive checksum with one extra step: sum every byte, keep the low 8 bits, then take the two's complement (invert the bits and add 1) of that sum, instead of using the plain sum directly.

Why go through the extra two's-complement step?

It makes verification self-checking — summing the original data bytes plus the checksum byte always gives exactly 0x00 (mod 256) if nothing was corrupted, which is simpler for a receiver to test than comparing against a separately stored expected value.

Is this the same as LRC?

Yes — LRC (Longitudinal Redundancy Check), used by Modbus ASCII and Intel HEX, is this exact technique under a specific name. This page explains the general technique; the Hex LRC Calculator frames it around those specific protocols.

How does this relate to the Hex Two's Complement Calculator?

That calculator negates a single hex value using two's complement; this page applies the same two's-complement operation as the final step of a multi-byte checksum, rather than to just one number.