The Hamming distance between two binary strings of the same length is the number of positions where the corresponding bits differ.

In a set of codewords (binary strings used to represent information), the minimum Hamming distance between any two codewords plays a crucial role. The larger the minimum Hamming distance, the more robust the code is to errors, as it allows detection of more bit-flip errors and, potentially, their correction.
The distance for two codes is defined as:

For any number of codes, the distance is:

For codes with a hamming distance , we can detect up to errors and correct them if we have errors (where we just need to find the closest codeword to the received word).

EXAMPLE

center
Note: The second example has a hamming distance 1 higher because we added a parity bit.

References

error-correcting codes