Hamming Distance Calculator

Calculate the Hamming distance between two equal-length strings.

Count the positions where two strings of equal length differ: the Hamming distance. Compare by characters (karolin and kathrin differ in 3 places) or by binary bits, where each character is turned into bits first. You also see the length and the number of matching positions. Hamming distance is used in error-correcting codes, DNA comparison and checking how many bits changed.

Common use cases

  • Learn error detection and correction in computer science
  • Compare two DNA or protein sequences of the same length
  • Count changed bits between two values

How to use

  1. Choose characters or binary bits.
  2. Enter two strings of the same length.
  3. Read the distance and matching positions.

FAQ

What if the strings are different lengths?

Hamming distance is only defined for equal lengths. For different lengths, use edit distance in the string similarity checker.

Where is it used?

In error-correcting codes such as Hamming codes, in genetics, and in comparing hashes and fingerprints.