Communication Networks · Visualized

Hamming Code Correction

Error Control

Detecting and correcting corrupted bits with parity, CRC and Hamming codes.

3 interactive subtopics — each one animated, step-through and explained.

Hamming Code Correction

Error Control

Hamming(7,4) weaves three parity bits among four data bits so that every possible single-bit flip produces a unique syndrome — a 3-bit number whose value is the position of the error. The receiver computes the syndrome, flips that one position back, and recovers the data with no retransmission.

How Hamming Code Correction Works

  1. Place data bits in positions 3,5,6,7; parity bits take positions 1,2,4.
  2. p1 checks positions 1,3,5,7; p2 checks 2,3,6,7; p4 checks 4,5,6,7 — even parity per group.
  3. Transmit the 7-bit codeword.
  4. Receiver recomputes all three group parities; the results form the syndrome s4 s2 s1.
  5. Syndrome 000 → clean. Otherwise syndrome (read as binary) names the exact flipped position — invert it.

Hamming Code Correction Worked Example

Try it: Enable “corrupt one bit”, replay — the syndrome points straight at the damaged cell and repairs it.

Data 1011 encodes to 0110011. Corrupt position 5 → syndrome computes to 101 = 5 → flip position 5 back. Two simultaneous flips would be miscorrected — Hamming guarantees only single-error correction.

position:bits:member:10g1parity21g2parity31g1·g2data40g4parity50g1·g4data61g2·g4data71g1·g2·g4data
group g1 group g2 group g4 flipped repaired
Stage 1 / 5
Data 1011 goes to positions 3·5·6·7; group parities fill 1·2·4 → codeword 0110011.

Hamming Code Correction: Key Facts to Remember

RateHamming(7,4) spends 3 parity per 4 data bits (rate 4/7)
Extensionadds one overall parity → SEC-DED: correct 1, detect 2
Where usedECC RAM, deep-space probes, flash controllers

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses

See how packets really travel

Networks are built on the structures and algorithms you can watch step by step — queues, trees, and routing algorithms.