Report

Help us improve this tool

Hamming Distance Calculator

Calculate the Hamming distance between two binary or decimal messages of equal length.

O M T

What Is Hamming Distance?

Hamming distance counts how many positions differ between two equal-length messages. In binary error correction, it measures how many bit flips separate two codewords.

How to Calculate Hamming Distance

Compare both messages position by position and count mismatches. For binary strings `10101` and `01100`, positions 1, 2, and 5 differ, giving a Hamming distance of 3.

Explore related tools: Hamming Code Calculator and Even Parity Calculator.

Frequently Asked Questions

What is the Hamming distance between 10101 and 01100?

The distance is 3. The strings differ at positions 1, 2, and 5 when compared left to right.

Can I use decimal numbers?

Yes. Switch to decimal mode and compare digit by digit. For example, 12271995 and 02071895 have a Hamming distance of 3.

Why does message length matter?

Hamming distance is only defined for equal-length strings. Pad or trim messages so both have the same number of digits before comparing.

Where is Hamming distance used?

It is central to error-correcting codes, coding theory, and machine learning similarity metrics for categorical data.

Is Hamming distance a true metric?

Yes. It satisfies non-negativity, identity, symmetry, and the triangle inequality, making it a valid mathematical distance function.