Skip to content
ENExplore Calculators

Hamming Distance Calculator

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

About Hamming Distance Calculator

The Hamming distance counts positions where two equal-length strings differ. A code whose minimum distance is d can detect d − 1 errors and correct ⌊(d − 1)/2⌋ of them.

Formulas

Hamming distance

d(a, b) = number of positions where the symbols differ

Error capability

detect d − 1, correct ⌊(d − 1)/2⌋

Worked example

With the default values below, Hamming Distance Calculator returns Hamming distance of 2. Change any input above and every figure here is recalculated in your browser.

Inputs used

First bit string
1011101
Second bit string
1001001

Results

Hamming distance
2
Compared length
7
Errors a code with this minimum distance detects
1
Errors it can correct
0

Step by step

  1. 1Values used
  2. 2Hamming distance
  3. 3Error capability
  4. 4Hamming distance= 2
  5. 5Compared length= 7
  6. 6Errors a code with this minimum distance detects= 1
  7. 7Errors it can correct= 0

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 whole numbers, 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

Distance between 1011101 and 1001001?

Two positions differ, so the distance is 2.

How does distance relate to correction?

Codewords must be far enough apart that a corrupted word is still nearest to the original, which needs a gap of 2t + 1 to correct t errors.

Hamming Distance Calculator | Calcrivo