(7,4) Hamming Code Encoder

An error-correcting code that can detect and fix single-bit errors

This circuit takes 4 data bits and adds 3 parity bits to create a 7-bit codeword. The parity bits are calculated using XOR gates so that any single-bit error can be identified and corrected.

Encoding Circuit
d1 d2 d3 d4 0 0 0 0 pos 3 pos 5 pos 6 pos 7 XOR 0 p1 XOR 0 p2 XOR 0 p3 p1 = d1 + d2 + d4 p2 = d1 + d3 + d4 p3 = d2 + d3 + d4
Try It: Interactive Encoder
Click data bits to toggle (0/1):
d1
d2
d3
d4
↓ Encoded Codeword ↓
7-bit output (click any bit to simulate an error):
p1
p2
p3
Data
Error Detection (Syndrome)
Syndrome:
0
0
0
= position 0
No error