Hamming Distance Calculator
Count the positions where two equal-length strings, binary values or hex values differ. Shows a position-by-position diff, normalised distance and similarity.
Result
Enter two values of the same length to see the Hamming distance and a position-by-position diff.
What is the Hamming Distance Calculator?
The Hamming distance between two strings of the same length is simply the number of positions where the symbols differ.
- Compares text, binary or hexadecimal values symbol by symbol
- Position-by-position diff grid with every mismatch highlighted
- Reports normalised distance and similarity percentage
- Adds a bit-level distance for binary and hex comparisons
- Explains clearly when the two inputs are different lengths
- Counts by Unicode code point, so emoji and accents are not double-counted
How to use the Hamming Distance Calculator
- 1
Type or paste your two values into the first and second boxes.
- 2
Choose whether to compare them as text, as binary digits or as hexadecimal.
- 3
For text, tick “Ignore letter case” if capitalisation should not count as a difference.
- 4
Read the distance and similarity in the stat tiles, and scan the diff grid below for the exact positions that differ.
- 5
Use “Copy summary” to take the numbers with you.
About the Hamming Distance Calculator
The Hamming distance between two strings of the same length is simply the number of positions where the symbols differ. This calculator takes two values, checks them position by position, and shows you exactly which ones do not match — highlighted in a diff grid you can read at a glance.
It is the metric behind error-detecting codes, DNA sequence comparison and hash similarity work, so it comes up in coding theory homework as often as it does in real engineering. Alongside the raw count you get the normalised distance (differences divided by length) and a similarity percentage, plus a bit-level distance when you compare binary or hex.
Everything is calculated in your browser with JavaScript. Nothing you type is uploaded, logged or sent to a server, so you can safely compare hashes, identifiers or private sequences — and the page keeps working offline.
Frequently asked questions
What is the Hamming distance between two strings?
It is the number of positions at which the two strings have different symbols. For example, “karolin” and “kathrin” differ in three positions, so their Hamming distance is 3.
Why do I get an error when the strings are different lengths?
Hamming distance is only defined for sequences of equal length, because it compares position 1 to position 1, position 2 to position 2 and so on. If your strings differ in length, use the Levenshtein distance calculator instead — it allows insertions and deletions.
How do I calculate the Hamming distance of two binary numbers?
Switch the mode to Binary and paste both values. Each bit is one symbol, so the distance is the number of differing bit positions. Spaces, underscores, colons and dashes in your input are ignored, so grouped values like 1011 1101 work fine.
What does the normalised distance mean?
It is the Hamming distance divided by the length, giving a value between 0 and 1. A normalised distance of 0 means identical, 1 means every position differs, and it lets you compare results across values of different lengths.
Is my data sent anywhere when I use this calculator?
No. The comparison runs entirely in your browser using JavaScript, so the values you paste never leave your device. That makes it safe for hashes, keys and other sensitive strings.
Related tools
Levenshtein Distance Calculator
Calculate the edit distance between two strings, with the full dynamic-programming matrix, plus Damerau-Levenshtein, Jaro-Winkler and Dice scores.
Soundex & Metaphone Calculator
Encode names phonetically with American Soundex, Refined Soundex, NYSIIS and Metaphone, and compare two names side by side for a sound-alike verdict.
Text Compare
Compare two texts online free and highlight every difference. A private text comparison tool that finds matches and changes right in your browser.
Character Counter
Count characters with and without spaces in real time and check limits for Twitter/X, Instagram captions, meta descriptions and SMS messages.
Binary Calculator
Do arithmetic and bitwise math on binary, decimal, hex and octal numbers — add, subtract, multiply, divide, AND, OR, XOR and shifts, with results in all bases.