Hamming Distance, Explained

IntermediateAbout 8 minData & binary

You've been calculating this every time you play LogicDash. Here's what it actually is.

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.

Check your understanding

5 quick questions. Pick one answer for each — you'll see why straight away.

  1. What is the Hamming distance between 1010 and 1000?

  2. What is the Hamming distance between 11001 and 10011?

  3. What is the Hamming distance between a pattern and an exact copy of itself?

  4. What is the largest possible Hamming distance between two 5-bit patterns?

  5. Outside of puzzles, Hamming distance is used to…