Advertisement

Hamming code calculator

Encode, inspect or decode binary Hamming codewords from 3 to 255 bits, showing the syndrome and a single-bit correction under an explicit error assumption.

Calculator

Codeword
0110011
Payload
1011
Syndrome (1-based bit position)
0.000000
Interpretation
Even-parity code generated
Parity positions
PositionBit
1.0000000.000000
2.0000001.000000
4.0000000.000000

Advertisement

How this calculator works

Number positions from left to right starting at one. Powers of two are parity positions; other positions carry data. Each even-parity check covers positions having its bit set in the position number. XORing the positions of all received one bits gives the syndrome. With at most one error, it identifies the flipped position. Ordinary Hamming codes do not have the extra overall parity bit used by SECDED.

Formula

n = 2^r - 1; data bits = n - r. Syndrome = XOR of the 1-based indices whose code bits are 1.

Worked example

In the stated left-to-right convention, payload 1011 encodes to 0110011 in Hamming(7,4). Changing position 5 gives 0110111; its syndrome is 5 and correcting that position restores 1011.

Advertisement

Frequently asked questions

Why is my codeword different from another tool?

Some tools number from the right or reverse payload order. This page explicitly numbers from the left.

Can it safely correct two errors?

No. Two errors can resemble a different single error. Correction assumes at most one flipped bit.

Does a zero syndrome guarantee a clean word?

No. Some patterns of multiple errors are themselves valid codewords and go undetected.

Sources

Advertisement