Hamming Code Calculator

Generate a Hamming (7,4) code from four data bits and detect or correct a single-bit transmission error.

Hamming (7,4) Code
Use even parity to encode four data bits. Optionally inspect a received seven-bit code.

About the Hamming code calculator

Hamming code is a family of error-correcting codes introduced by mathematician Richard Hamming. It adds carefully positioned parity bits to a data word so a receiver can identify and repair a single changed bit. The Hamming (7,4) scheme used here transforms four data bits into a seven-bit codeword. It is a compact demonstration of the same error-control principles used in digital communications, computer memory, storage systems, and embedded electronics. Seven code positions are numbered from one through seven. Parity bits occupy positions one, two, and four because those positions are powers of two. The four original data bits occupy positions three, five, six, and seven. Each parity bit checks a different overlapping group of positions. This calculator uses even parity, meaning every checked group should contain an even number of ones after its parity bit is included. For data bits d1, d2, d3, and d4, parity p1 checks d1, d2, and d4. Parity p2 checks d1, d3, and d4. Parity p4 checks d2, d3, and d4. The resulting order is p1, p2, d1, p4, d2, d3, d4. Encoding 1011 therefore produces 0110011. You can verify each parity group by counting its ones. When a seven-bit code arrives, the receiver repeats the three parity checks. Failed checks form a three-bit syndrome whose numeric value identifies the erroneous position. A syndrome of one points to the first bit, a syndrome of five points to the fifth bit, and a syndrome of zero indicates no single-bit error. Flipping the identified bit restores the original valid codeword. The optional received-code field demonstrates this process and displays the corrected sequence. Standard Hamming (7,4) code guarantees correction of one-bit errors, but it cannot reliably distinguish every two-bit error. Extended Hamming code adds an overall parity bit to provide single-error correction and double-error detection. This calculator intentionally focuses on the classic seven-bit version and even parity. Enter only zeros and ones, with no spaces, prefixes, or separators, so bit positions remain unambiguous.

Hamming code examples

Data or received codeResultExplanation
Data 10110110011Parity bits are 0, 1, and 0.
Data 11011010101Parity bits are 1, 0, and 0.
Received 0010101Error at position 1Flipping the first bit restores 1010101.

How to use the Hamming code calculator

  1. Enter exactly four binary data bits without spaces or separators.
  2. Optionally enter a received seven-bit codeword to check it for a transmission error.
  3. Select Calculate Hamming Code to generate the even-parity codeword.
  4. Review the syndrome result and corrected code when a received word was provided.

Hamming code FAQ

What does Hamming (7,4) mean?

The codeword contains seven bits in total and carries four original data bits. The other three bits provide parity information for error correction.

Which parity convention does this calculator use?

It uses even parity for all three parity groups. A valid checked group therefore contains an even number of one bits.

How does the syndrome locate an error?

Each failed parity check contributes one binary place value to the syndrome. The combined value equals the one-based position of a single erroneous bit.

Can Hamming (7,4) correct two errors?

No, it is designed to correct one changed bit per codeword. Two changed bits can produce a misleading syndrome and should not be treated as safely correctable.

Where are Hamming codes used?

They are used to teach coding theory and appear in memory, communication, and storage designs. Real systems often use extended or more powerful codes depending on their reliability requirements.