Maths & numbers

Hamming distance between bit words calculator

Measure how many bit positions must change to turn one unsigned word into the other.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Measure how many bit positions must change to turn one unsigned word into the other.

THE FORMULAXOR the two words and count the one bits

A worked example

1100 and 1010 differ in two positions.

Good to know

Words are compared with leading zeros as needed.

Read the result

Measure how many bit positions must change to turn one unsigned word into the other.

The primary result is labeled “Differing bits”. Keep the input definitions in view when comparing this result with another method.

Try a related calculation

Words are compared with leading zeros as needed.

For a related exercise, try the greatest common divisor.

A few questions, answered

How can I check the default inputs by hand?

1100 and 1010 differ in two positions.

Which rule does this calculator apply?

XOR the two words and count the one bits

Find your calculator

Start typing to explore the library.