Hamming Distance Calculator

Count the differing bits between two numbers.

Hamming distance 8
XOR (binary) 11111111

Formula: Count the 1 bits in A XOR B

Step-by-step with your numbers:
1. Values used:
2. Value A = 156
3. Value B = 99
4.
5. Hamming distance = 8
6. XOR (binary) = 11111111
Did we solve your problem today?

The Hamming distance is the number of bit positions where two values differ.

The math behind it

XOR the two numbers and count the 1 bits in the result.

Worked example

156 (10011100) vs 99 (01100011) differ in 8 bits.

FAQ

Where is it used?

Error detection and correction, and comparing binary codes.