🔍

🔢 Hamming Distance Calculator

Compare the binary representations of two whole numbers and see how many bits differ between them.

1
2
3

What Hamming distance measures

The Hamming distance between two equal-length binary values is the number of bit positions at which they differ. It is widely used in coding theory, error detection and correction, and digital communications to measure how different two codes or signals are.

How this calculator works

Enter two whole numbers and choose a bit width. The calculator converts both numbers to binary at that bit width, computes the exclusive-or (XOR) of the two values (which produces a 1 in every position where the bits differ), and counts the number of 1 bits in the result. That count is the Hamming distance.

Hamming distance only measures differences at matching bit positions; it assumes both values are compared at the same fixed bit width. This tool is for general educational and technical reference.

Last reviewed August 2026