Toolstia / Hamming distance calculator

Hamming distance calculator

Hamming distance is the number of positions at which two sequences of equal length differ. Compare text characters, the bits of text, binary digits or hex values and see which positions differ.

Hamming distance counts the places where two inputs of the same length differ. It is used in error detecting codes and to compare hashes. For inputs of different length, use an edit distance such as Levenshtein instead.

How it works

  1. Choose what to compare.
  2. Enter the two values.
  3. Read the distance, similarity and the list of differing positions.

Text mode

Counts the characters that differ at the same position. The classic example is karolin and kathrin, which differ in three places.

Bits

Bit modes convert the input to bits first, so a distance of 1 means a single flipped bit. This is how error detecting codes are measured.

Equal length only

The two inputs must have the same length. For different lengths, an edit distance such as Levenshtein is the right tool.

Uses

Error correcting codes, comparing hashes and fingerprints, and DNA mismatch counts.

Questions

Is my input sent anywhere?

Everything happens in your browser, and nothing you enter is sent anywhere.

What is the similarity figure?

It is the share of positions that match, as a percentage of the length.

Why does it complain about length?

Hamming distance is only defined for inputs of the same length.