About the Hamming Distance Calculator
The Hamming distance is the number of places in which two strings of the same length differ. This calculator counts those places for text, or for the bits of two binary strings, shows which positions differ and gives the share of positions that do not match. Type two strings of the same length and the Hamming distance appears at once, with a few related figures underneath, and you can copy the result with one tap. The sums run in your browser, so nothing you enter is uploaded.
Updated October 2026
How to use the Hamming Distance Calculator
- 1Enter two strings of the same length.
- 2Pick the units or options from the menus if the Hamming distance tool offers them.
- 3Read the Hamming distance in the large result box.
- 4Look at the extra rows for related figures.
- 5Press Copy result to keep the answer.
When you need the Hamming distance
It is used in error detection and correction, in coding theory, in genetics to compare DNA strings and in programming exercises.
A distance of 0 means the strings are the same. A larger distance means more errors needed to change one into the other. For strings of different lengths, use the Levenshtein distance instead.
How the Hamming distance is worked out
Compare the strings position by position and count the mismatches. karolin and kathrin differ in 3 places (positions 3, 4 and 5), so the distance is 3. The bit strings 1011101 and 1001001 differ in 2 places.
Every answer on this page comes from that one rule, so you can check any result by hand with a calculator. The figures shown underneath, such as other units, are conversions of the same answer.
- Text and bit modes
- Positions that differ
- Percent mismatch
Mistakes to avoid with Hamming distance
Both strings must be the same length, and the tool reports an error if not. In bit mode, only the digits 0 and 1 are allowed.
On phone and computer
On a phone, type into the boxes one after another and read the Hamming distance underneath; Copy result puts it on the clipboard for a message or a note. On a computer the inputs sit on the left and the answer on the right, so you can change one figure and watch the Hamming distance move. The hamming distance calculator works the same on both.
Checking your Hamming distance by hand
A good habit is to test the hamming distance calculator with a case you already know. karolin and kathrin differ in 3 places (positions 3, 4 and 5), so the distance is 3. The bit strings 1011101 and 1001001 differ in 2 places.
If your own figures give a surprising answer, repeat the working yourself: Compare the strings position by position and count the mismatches. Small differences usually come from rounding, from mixing units, or from a typing slip in one of the inputs. Hamming distance only compares strings of equal length. When lengths differ, use the Levenshtein Distance Calculator instead. For word games, the Anagram Checker tests letters, and the Binary Translator shows the bits you may want to compare.
Features
- Equal length only
- Case matters
- Levenshtein handles unequal lengths
- Clear messages when the Hamming distance inputs make no sense
- Copy the result with one tap
- Private: nothing is uploaded
Frequently asked questions
How do I calculate Hamming distance?
Compare the strings position by position and count the mismatches. karolin and kathrin differ in 3 places (positions 3, 4 and 5), so the distance is 3. The bit strings 1011101 and 1001001 differ in 2 places.
What is the formula for Hamming distance?
Compare the strings position by position and count the mismatches. The hamming distance calculator applies it exactly and rounds only the displayed answer to six significant figures.
What if my strings differ in length?
Use the Levenshtein distance, which allows inserts and deletes.
Who invented it?
Richard Hamming, in his work on error-correcting codes.
Is case relevant?
Yes. A and a count as different.
Is this hamming distance calculator free and private?
Yes. It is free, needs no account and runs in your browser, so the numbers you type are not uploaded or stored.