XOR Checksum Calculator
XOR hex bytes to a one byte checksum with count.
What it does
Checksums catch transmission slips with one byte. XOR folds every byte with exclusive or: bits differ to 1, match to 0. A flipped bit changes the fold, flagging the block.
The tool above takes even hex and returns checksum hex, decimal, and byte count. The default 48656C6C6F (Hello) matches the worked example, so the page opens showing 0x42. Type new hex to update all three results.
Folding runs left to right from zero. Here 0x48 xor 0x65 is 0x2D, xor 0x6C is 0x41, xor 0x6C is 0x2D, xor 0x6F is 0x42. Decimal 66 names the same byte. Order does not matter for XOR.
Use this for NMEA sentences, serial frames, and teaching parity. For stronger integrity use CRC or hashes. This catches odd bit flips, not all burst errors.
This page shows the method, one full hand checked example for Hello, a reference table, and practice checks that run through the tool.
How to use
- Type hex bytes with 0-9 and A-F.
- Keep length even for full bytes.
- Keep 1 to 20 bytes (2 to 40 chars).
- Read Checksum hex as two capitals.
- Read decimal for code use.
- Split longer frames into chunks.
Formula
- xor
- Exclusive or per bit.
- byte
- Two hex chars, 0 to 255.
- count
- Bytes folded.
Spaces and dashes strip first. Odd length or non hex stops with a message. Empty folds to 0x00 but this tool requires at least one byte.
Worked example
Example: 48 65 6C 6C 6F
XOR the Hello bytes to one checksum.
- Bytes: 48, 65, 6C, 6C, 6F (5 bytes).
- 48 xor 65 = 2D.
- 2D xor 6C = 41.
- 41 xor 6C = 2D.
- 2D xor 6F = 42.
- Hex 42 is decimal 66.
Reference table
| Hex | XOR | Bytes |
|---|---|---|
| 48656C6C6F | 42 (66) | 5 bytes |
| 00FF | FF (255) | 2 bytes |
| 0102 | 03 (3) | 2 bytes |
Limits
- XOR only. Use CRC or hash for strong integrity.
- 1 to 20 bytes per run here.
- Hex only. Text needs hex encode first.
- Detects many, not all, burst errors.
Common mistakes
- Odd hex length with a half byte.
- Pasting 0x prefixes that break validation. Strip them first.
- Reading decimal 66 as hex 66.
- Expecting order to matter for XOR.
- Using XOR where CRC is required.
Try it yourself
Quick checks. Answers sit tucked under each question.
XOR 00FF?
Hex FF, decimal 255, 2 bytes.
XOR 0102?
Hex 03, decimal 3, 2 bytes.
Questions
Hello XOR?
0x42 (66) over 5 bytes.
Even length?
Yes. Full bytes only.
Spaces?
They strip before math.
Order?
Irrelevant for XOR.
Strong?
No. Use CRC or hash for safety.
Max?
20 bytes per run here.