Hamming Distance, Explained
You've been calculating this every time you play LogicDash. Here's what it actually is.
Swipe or tap Next for the next section
The Basic Idea
Hamming distance is just a fancy name for a simple question: how many positions are different between two binary patterns?
Take two 5-bit patterns:
Highlighted tiles mark the positions that differ.
- Position 1: 1 vs 1 → same
- Position 2: 0 vs 0 → same
- Position 3: 1 vs 0 → different
- Position 4: 1 vs 1 → same
- Position 5: 0 vs 1 → different
Two positions are different. So the Hamming distance is 2.
That's the Whole Game
When LogicDash tells you "2 bits off," it's telling you the Hamming distance between your guess and the secret. It never tells you which positions are wrong — just how many. Figuring out which ones takes logic, not luck.
Where This Idea Comes From
Hamming distance isn't just a puzzle mechanic — it's a real concept from computer science, named after Richard Hamming, who worked on it in the 1940s while trying to solve a very practical problem: how can a computer tell when data has been corrupted, and fix it automatically?
That idea is still everywhere today — it's part of how your phone's memory checks for errors, how satellites send data across huge distances without it arriving garbled, and how barcodes and QR codes stay readable even when partly damaged.
5 quick questions. Pick one answer for each — you'll see why straight away.
What is the Hamming distance between 1010 and 1000?
Only the third position differs (1 vs 0), so the distance is 1.
What is the Hamming distance between 11001 and 10011?
Compare position by position: the 2nd and 4th differ. Two differences → a distance of 2.
What is the Hamming distance between a pattern and an exact copy of itself?
Nothing differs, so the distance is 0.
What is the largest possible Hamming distance between two 5-bit patterns?
At most, every one of the 5 positions is different.
Outside of puzzles, Hamming distance is used to…
Richard Hamming invented it to help computers notice — and fix — bits that got flipped by mistake.