Hamming Code Generator
Hamming's insight was that parity bits placed at powers of two, each checking an overlapping set of positions, make the failing checks spell out the position of the error in binary. Nothing has to be looked up and nothing has to be re-sent. This encodes four bits as seven, corrupts whichever bit you choose, and shows the syndrome doing exactly that.
What this generator does
Places three parity bits at positions 1, 2 and 4 and the four data bits around them, flips the bit you nominate, recomputes the parity checks, and corrects the position the syndrome names. The recovered data is compared against what was sent.
How to use this tool
- Enter four data bits as a number from 0 to 15.
- Choose which transmitted bit to corrupt, or 0 for a clean run.
- Read the syndrome — it is the error's position in binary.
- Check the recovered data against what you sent.
Understanding the controls
- Four data bits
- Entered as a number from 0 to 15, so 11 means 1011. Every one of the sixteen possible messages behaves the same way.
- Corrupt bit
- Which of the seven transmitted bits to flip. Zero sends it cleanly, and the syndrome comes out zero.
Common use cases
- Working through Hamming(7,4) with your own bits
- Teaching why parity positions are powers of two
- Showing error correction without retransmission
- Producing worked examples for a coding theory course
- Checking a Hamming implementation against known output
How this generator works
Each parity bit covers the positions whose index has that parity bit's own bit set, so position 5 is covered by the checks at 1 and 4, position 7 by all three. Recomputing the three checks at the far end gives three bits, and read as a binary number they are the position of the single wrong bit — or zero if nothing went wrong. Before display the corrected data is compared against the original four bits, and the syndrome is confirmed to name the position that was actually flipped.
Randomness and fairness
Nothing here is random. The four bits and the chosen error position determine everything.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- One error only: Hamming(7,4) corrects a single flipped bit and silently mis-corrects two, which is a real property of the code rather than an implementation shortcut.
- No extended parity bit, so double errors are not even detected — the SECDED variant adds one for that.
- This is the classic seven-four code only; longer Hamming codes carry more data per parity bit.
- It corrects flipped bits, not lost or inserted ones, which need a different kind of code entirely.
Privacy and your data
The encoding runs in your browser and nothing you enter is transmitted, stored or included in analytics.
Related generators
- Random Binary String GeneratorA string of 0s and 1s of a fixed length — not a converted number.
- Huffman Code GeneratorBuilds an optimal prefix code for your text, shows every character's bit pattern, and decodes the bits back to prove it works.
- Checksum Test Number GeneratorA fictional, mod-10-checksum-valid test number, for testing validation code.
- Gray Code GeneratorBit sequences where consecutive entries differ in exactly one position, checked at every step including the wrap.