Checksum Calculator: Sum, XOR & Internet Ones-Complement

Checksum Calculator

Turn any byte stream into a checksum. Enter hex bytes, decimal bytes or ASCII text, then compute SUM-8, SUM-16, XOR/LRC, the two's-complement checksum, or the one's-complement Internet checksum with end-around carry. See the running total, the final modulo or complement step, and a PASS/FAIL verify against an expected value.

🔗Real Byte-Stream Presets

📝Data & Method

Space or comma separated bytes for hex/decimal input, or any characters for ASCII text.

How the data field above is parsed into 0-255 bytes.

Primary algorithm used for the main result card.

Sets the modulus for SUM and the mask for XOR and two's-complement.

Hex like 0x1A or DEC value. Leave blank to skip verify.

Adds a byte-by-byte running total to the breakdown panel.

Primary checksum 0x00 chosen method result
Alternate form 0 decimal and binary
Raw sum & byte count 0 total of all bytes
Verify / complement -- PASS, FAIL or check byte

🔢Checksum At A Glance

SUMsum mod 2^n
XORb1 ^ b2 ^ bn
2's256 - sum
~Sones complement

📋Worked Example: Bytes 49 50 51

MethodOperationResult (hex)Reads As
Raw sum49 + 50 + 510x96150 decimal
SUM-8150 mod 2560x96150, no wrap
SUM-16150 mod 655360x0096150 as word
XOR-8 / LRC49 ^ 50 ^ 510x3048 decimal
Two's-comp 8256 - 1500x6A106, sum->0
Ones-comp 16~0x00960xFF69Internet form

🗃Checksum Method Comparison Grid

MethodWidthDetectsSpeedUsed InNote
SUM-88-bitMost single-byte flipsFastestSimple serial, EEPROMMisses byte swaps
SUM-1616-bitWider than SUM-8FastFirmware imagesStill order sensitive
XOR / LRC8-bitOdd bit errorsFastestNMEA 0183, ISO 1155Blind to byte order
Two's-comp8-bitSame as SUM-8FastIntel HEX, S-recordSum + cksum = 0
Ones-comp16-bitEnd-around carry errsFastIPv4, TCP, UDPCarry folded back
Fletcher-1616-bitOrder and burst errsMediumTCP alt, RFC 1146Two running sums
Adler-3232-bitBetter on long dataMediumzlib, PNGWeak on short input
CRC-3232-bitBursts up to 32 bitsSlowerEthernet, ZIP, PNGStrongest, out of scope

🌐ASCII Value Quick Reference

CharacterDecimalHexBinary
0 (zero)480x3000110000
9570x3900111001
A650x4101000001
Z900x5A01011010
a970x6101100001
space320x2000100000
* (NMEA)420x2A00101010

🧮Modulus & Mask Reference

WidthModulusMask (hex)Max Value
8-bit2560xFF255
16-bit655360xFFFF65535
24-bit167772160xFFFFFF16777215
32-bit42949672960xFFFFFFFF4294967295

Formula Breakdown

Running sum SAdd every byte into one accumulator: S = b1 + b2 + ... + bn. This raw total feeds all of the sum-based checksums below before any wrap or complement.
SUM-8 = S mod 256Keep the low 8 bits of the running sum. Bytes 49 + 50 + 51 = 150, and 150 mod 256 = 150 = 0x96, a single check byte.
SUM-16 = S mod 65536Keep the low 16 bits instead, giving a two-byte checksum that wraps far less often on longer messages.
XOR-8 = b1 ^ b2 ^ ... ^ bnExclusive-OR every byte. Order does not matter, and any single bit that flips an odd number of times is caught. This is the classic LRC.
Two's-comp = (256 − S mod 256) mod 256The value that makes the total roll to zero. For S = 150, checksum = 256 − 150 = 106 = 0x6A, so (150 + 106) mod 256 = 0.
Internet sum with carryAdd data as 16-bit words. Whenever the sum exceeds 0xFFFF, add the overflow carry back into the low 16 bits (end-around carry).
Ones-comp = ~sum & 0xFFFFTake the one's complement of the folded 16-bit sum. The receiver re-adds everything including this field and expects 0xFFFF, meaning zero errors.
Verification ruleAppend the checksum to the data and recompute. A correct sum-type message resums to 0, and a correct Internet checksum resums to all ones (0xFFFF).

💡Practical Checksum Tips

XOR hides byte swaps: Because XOR-8 is order independent, swapping two bytes leaves the LRC unchanged, so a frame like 41 42 and 42 41 share the checksum 0x03. When byte order matters, prefer a modular SUM or, better, Fletcher-16 which weights position. Reserve XOR/LRC for protocols like NMEA 0183 that already define it.
Fold the carry, then verify: The Internet checksum only works if you add the 16-bit overflow back in with end-around carry before taking the complement; skip that step and roughly 1 in 65536 errors slips through. To self-check, append the two checksum bytes and resum, then confirm the result is 0xFFFF before you trust the packet.

You might say, “I am sending this packet across the network” or “I am sending this firmware update across this microcontroller,” hoping it arrives. “I hope it gets there.” Optimistic! Bytes get corrupted by storage decay and interference and other forms of noisy disorder every day.

Checksums are little fingerprints computed from a block of bytes to let a recipient know if the data got through in one piece. Enter your hex/dec/plain-ASCII-text byte stream here. This calculator uses several classic checksumming algorithms on it, combining them into a single number. These include the one’s-complement Internet checksum, two’s-complement values used in firmware records, the XOR-based redundancy check, and even the simple-but-effective modular sum.

How Checksums Work

See the pass-or-fail verdict compared with your expected value, then the running total and how it gets wrapped into final result. The main task of each and every checksum are the same: to take lots of bytes and reduce them to some small number, which will change whenever the underlying data does. It’s easiest to just add up all those bytes. When there’s even a single flip in any of them, total is typically different then, and the recipient instantly sees the two aren’t matching.

They are designed to be inexpensive because they must operate on the tiniest microcontroller with the strictest power budget. They also run across every packet traversing a busy network backbone. They’re not cryptographic hashes, so they won’t prevent a malicious attack. But if you want to catch a dropped byte or other random transmission noise? A well chosen checksum does the job quick and effectively. This is a key factor when choosing what to use for an embedded system.

It calculates the running sum of all bytes, taking the low bits and discarding everything else. With SUM-8, this means the calculator do the addition and drops off the high byte. The result is one check byte (the remaining sum of all bytes modulo 256). With SUM-16, we take the sum modulo 65536. This means the result has twice as many bits but fewer overflows at the end of longer messages. Let’s look at the numbers 1, 9 in decimal, which are represented in ASCII. Their byte values range from 49 to 57. When added together, they make 477, while 477 modulo 256 equals 221 or 0xDD.

You can easily switch between moduli of 256 and 65536 using the width setting. Moreover, the breakdown panel displays the actual running sum as well, allowing you to track each step of calculation. That helps you trust the outcome.

Instead, the LRC (XOR) checksum takes the exclusive-OR of each byte. It’s like summing them except output bit is the parity of that bit at that position in all of the bytes. In other words, if there’s one or three or five flipped bits on that particular spot then the checksum will flip. GPS and most marine protocols use NMEA 0183 which uses XOR. All those hex digits following the asterisk are just the XOR of all characters in the sentence.

Its only quirk is that XOR doesn’t care about byte ordering. Changing two bytes doesn’t change result. So it’s easy but blind to byte transposition. For this reason, sums are often used with order dependent links. It does something but you need to understand what it doesn’t do.

Intel HEX files and Motorola S-records use a two’s-complement checksum. They do not record the actual sum, but the number whose addition would make total equal zero (sum modulo 256) again. That’s 256 minus the sum modulo 256. So if the sum of your data bytes is 150, then the checksum is 256. 150 = 106 or 0x6A. The beauty part is how it checks: add up all your data bytes and the checksum. The result will be exactly zero in its lower eight bits for a proper message. When we don’t expect a certain value, this calculator puts the surface check byte on the result card. What you see is always the balancing value of the frame.

This powers all the internet. It’s the most important algorithm of them all. The 16-bit one’s-complement checksum from RFC 1071 covers everything. This includes IPv4 headers, UDP datagrams, and TCP segments. Here’s how it works: Each 16-bit word of the data is treated as an unsigned integer, summed together. If the running sum ever goes over 0xFFFF, carry is end arounded back into the low 16 bits. Then, after folding-in all the words, the sum is bitwise inverted using a one’s complement. The receiver adds up all the words, including the checksum field, and should of get a result of 0xFFFF, aka all ones, which verifies there were no errors. This tool displays both the complement and the folded sum, and runs through carry-folding process.

So yeah, this feature lets you verify a checksum, which is cool. Fill out the expected field with whatever checksum a device said the data had. Select the right length and type, and the calculator checks whether the computed value match the pasted-in value. A green PASS means the bytes match the checksum. A FAIL means either the checksum algorithm was incorrect or at least one byte was different. It reinforces the two golden rules from the breakdown: append a sum-type checksum and the data will resume to 0. An Internet checksum should resum to 0xFFFF. These invariants allow you to verify a frame against itself, with no outside reference.

Which works best depends on your threat model. The weak-but-fast approach uses simple sums. It catches most single-bit noise but misses byte swaps. The Internet checksum adds with carry to get position-sensitivity. It is the right default for network work. If you really want robust error detection across bursts of errors, then a cyclic redundancy check like CRC-32 is much stronger. And it’s not in this live calculator.

Choose one of the presets, and tweak the number of bytes. Run the sum, and voila! One click and the correct checksum just falls out. You ship it off into the wild, hoping it gets there intact. The checksum is the silent proof it did.

Checksum Calculator: Sum, XOR & Internet Ones-Complement