Encode data 1011 as Hamming (7,4) — Hamming code
intro3 parity bits, 4 data bits
Answer
0110011
Why this example is worth doing
The canonical (7,4) example. Parity bits occupy positions 1, 2 and 4 — the powers of two — and the data bits fill the rest, so the codeword interleaves them rather than appending a parity block. The tool shows which positions each parity bit covers and the even-parity calculation for each. That interleaved layout is not arbitrary: it is exactly what makes the syndrome point at the error, which the next example demonstrates.
Try your own input in the Hamming code. Encode, inject an error, and watch the syndrome point straight at the flipped bit.
How the answer is reached
Hamming (7,4) encode
Hamming (7,4): 3 parity bits, because 2^3 = 8 ≥ k + r + 1 = 8.
Data word1011
| Position | Binary index | Holds | Bit |
|---|---|---|---|
| 1 | 001 | p1 | 0 |
| 2 | 010 | p2 | 1 |
| 3 | 011 | d1 | 1 |
| 4 | 100 | p4 | 0 |
| 5 | 101 | d2 | 0 |
| 6 | 110 | d3 | 1 |
| 7 | 111 | d4 | 1 |
Each parity bit is the XOR of the data bits it covers, so every check comes out even.
p11 ⊕ 0 ⊕ 1 = 0— covers positions 3, 5, 7
p21 ⊕ 1 ⊕ 1 = 1— covers positions 3, 6, 7
p40 ⊕ 1 ⊕ 1 = 0— covers positions 5, 6, 7
Codeword0110011Highlighted cells are parity bits.
Positions are 1-indexed: the first character of the codeword is position 1.
Source: R. W. Hamming, Bell System Technical Journal 29(2):147–160 (1950)