Skip to content
ENExplore Calculators

Hamming Similarity Calculator

Work out hamming similarity instantly with clear inputs, formula shown and shareable results.

About Hamming Similarity Calculator

Hamming distance counts the positions at which two equal-length sequences differ, so similarity is one minus that count over the length. It underpins error-detecting codes, SimHash near-duplicate detection and locality-sensitive hashing over binary fingerprints, where a distance of a few bits out of 64 marks two documents as near-identical.

Formula

Hamming distance

d = number of positions where the sequences differ; similarity = (length - d) / length

Worked example

With the default values below, Hamming Similarity Calculator returns Hamming similarity of 71.43%. Change any input above and every figure here is recalculated in your browser.

Inputs used

First string or bit vector
1011101
Second string or bit vector
1001001

Results

Hamming similarity
71.43%
Hamming distance
2
Positions compared
7
Positions differing
28.57%

Step by step

  1. 1Values used
  2. 2Hamming distance
  3. 3Hamming similarity= 71.43
  4. 4Hamming distance= 2
  5. 5Positions compared= 7
  6. 6Positions differing= 28.57

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What if the strings are different lengths?

Hamming distance is only defined for equal lengths. Length differences are counted as mismatches here, but for genuinely different lengths Levenshtein distance is the right measure.

Why use Hamming distance on hashes?

SimHash and similar fingerprints map similar content to similar bit patterns, so a small Hamming distance between 64-bit signatures identifies near-duplicates in constant time.

Hamming Similarity Calculator – Calculate Hamming similarity