Hamming Codes

Encode, flip bits, detect and correct single-bit errors

1. Input Message (4 bits)

Message:

2. Codeword (7 bits)

Click a bit to flip it (simulate error)

Parity Check Matrix H


Syndrome s = H·c (mod 2)


Error Location


Hamming Bound


Try Different Codes

Hamming(7,4): 4 data bits + 3 parity bits = 7-bit codeword. Minimum distance d=3 → correct 1 error. Syndrome s=H·c(mod2) gives binary address of the error. The Hamming bound: 2^(n-k) ≥ C(n,0)+C(n,1) = 1+n. Perfect codes meet this bound exactly. Hamming(7,4) is perfect: 2³=8=1+7. ✓