Hamming Distance Calculator
Calculate the Hamming distance between two strings of equal length. Measures the number of positions at which corresponding characters differ.
Input
Output
Readme
What is Hamming distance?
Hamming distance is a metric that measures the minimum number of substitutions required to change one string into another, or the number of errors that transformed one string into the other. Named after Richard Hamming, it's particularly useful in information theory, coding theory, and error detection. The key requirement is that both strings must be of equal length.
Tool description
This calculator computes the Hamming distance between two strings of equal length. It counts how many positions have different characters and provides a similarity percentage. The tool is useful for comparing binary data, detecting errors in transmitted data, and analyzing string similarity.
Examples
Example 1: Simple text comparison
- String 1:
hello - String 2:
hallo - Hamming Distance: 1 (only the 'e' vs 'a' differs)
Example 2: Binary strings
- String 1:
10101010 - String 2:
11001011 - Hamming Distance: 3 (positions 2, 5, and 8 differ)
Example 3: DNA sequences
- String 1:
AGCTTAGC - String 2:
AGCTTGGC - Hamming Distance: 1 (position 6 differs: A vs G)
Features
- Real-time Hamming distance calculation
- Automatic similarity percentage calculation
- Error detection for strings of different lengths