Hamming Code (7,4) Generator
Encode 4 data bits into 7 Hamming bits with parity, capable of correcting 1 wrong bit. Also demonstrates error detection.
Hamming (7,4): fixing one wrong bit without asking again
The Hamming code solves a specific problem: detecting and correcting a single flipped bit without needing anything resent. It does this by adding parity bits at deliberately chosen positions — the powers of two. In the (7,4) version, four data bits become seven transmitted bits, with three parity bits at positions 1, 2 and 4.
Type the four data bits and the page shows the encoded word. By choosing to inject an error at any position from 1 to 7, you see what arrives at the other end, the syndrome the receiver computes and the correction applied. The elegant part of the scheme shows up right there: the syndrome, read as a binary number, is exactly the position of the flipped bit. Zero means nothing was corrupted.
The limit is honest and worth knowing: one wrong bit is corrected, two wrong bits are detected as an error but corrected into the wrong word. That is why the extended variant exists, with one more global parity bit, which tells the two cases apart. Hamming shows up in ECC memory, where an isolated cell failure is common and resending is not an option.
Frequently asked questions
Why do the parity bits sit at powers of two?
Does this protect against tampering?
What does the code cost?
Related Tools
JavaScript Formatter
Format and indent JavaScript code for better readability and debugging.
Gray Code Table Generator
List all 2^N Gray codes for N bits (1 to 8). Shows binary side-by-side and highlights the 1-bit transition.
HTML Validator
Check for syntax and structure errors in HTML code. Identify unclosed tags and common problems.
JSON Validator
Validate JSON data to check for syntax errors. Detailed error report with line and position of the problem.
YAML Validator
Validate YAML data to check for syntax and indentation errors.
HTTP Status Codes
Look up all HTTP status codes with names and descriptions. Search by code or keyword. Quick reference for developers.