Hex Compare / Diff

This is a hex compare / diff tool. XOR is the bit mask of what changed; Hamming distance is how many bits differ. 0x3C vs 0x3E at 8 bits is one bit, mask 0x02.

Examples — click a swatch

Click a bit on A or B to flip it. Red rings mark bits that differ.

A

B

XOR

Hex digits with a changed nibble are ringed.

Click a value to copy it

Batch (one per line or commas)

One pair per line: 0x3C 0x3E or 3C,3E. Fill example loads three rows; the table shows Hamming and XOR.

This is a hex compare / diff tool

This page compares two integers of the same width and shows which bits changed. XOR is the mask of differing bits; Hamming distance is how many 1s that mask has. 0x3C vs 0x3E at 8 bits is distance 1, mask 0x02. 0x10 vs 0x01 is distance 2 even though subtraction is 15. HEX, XOR, Hamming stay untranslated. This is not the hex bitwise calculator (AND/OR/NAND and shifts), not a hex dump of two files, and not the text diff.

How to use

  1. Enter A and B as Hex, Decimal, or Binary. Pick Auto / 4 / 8 / 16 / 32 / 64 bits. Auto uses the smallest of 8/16/32/64 that fits the larger value.
  2. Red rings mark bits that differ on A, B, and the XOR row. Click a bit on A or B to flip it. Swap A / B exchanges the two fields.
  3. Stats: Hamming, matching bits, similarity %, bits set only in A, bits set only in B. Hex digits with a changed nibble are ringed. Differing bit indexes count from the right (LSB = 0): 0x3C vs 0x3E is bit 1.
  4. Show example is 0x3C vs 0x3E. Extra chips: 0x10 vs 0x01, 0xFF vs 0x00 (distance 8), 0xAA vs 0x55 (distance 8), 0xF vs 0x1F (distance 1 at 8 bits). Copy result copies the XOR hex mask.
  5. Batch is one pair per line (spaces or commas). The table lists Hamming and XOR for each pair at the current width.

Notes

Values are masked to the width; shorter hex is zero-padded on the left. A Hamming distance of 1 is a single-bit flip. Similarity is matching bits divided by width. Related: hex bitwise if you need the XOR value as an operator among AND/OR, and hex dump to inspect a whole buffer.

Where to use it

  • Register dumps: did exactly one flag change, or did several bits move?
  • Two checksums or hash prefixes that should be identical — Hamming 0 means they match bit for bit.

Questions

Is this the same as subtraction?

No. 0x10 vs 0x01 subtracts to 15, but only two bits differ (Hamming 2, mask 0x11).

Why does 0xF vs 0x1F look like one bit at 8 bits?

Both are padded to 00001111 and 00011111. Without a shared width you would be comparing different lengths.

Can I compare two files?

Not here. Paste short hex values. For a byte dump of one buffer use hex dump.