TFT

Hamming Code Encoder and Decoder

Encode data with Hamming code to add error-correcting bits, or decode Hamming-encoded data to detect and correct single-bit errors. This tool is educational for understanding error-correcting codes.

Hamming Code Encoder/Decoder

Encode data with Hamming error-correcting code or decode and detect/correct errors

About Hamming Code

Hamming code is an error-correcting code invented by Richard Hamming. It can detect and correct single-bit errors in data transmission. The code adds parity bits to the data bits at specific positions (powers of 2).

Hamming(7,4) encodes 4 data bits into 7 bits (3 parity bits), while Hamming(15,11) encodes 11 data bits into 15 bits (4 parity bits). Both can detect and correct any single-bit error.

How the Hamming Code Encoder/Decoder Works

Enter binary data to encode with Hamming error correction, or input Hamming-encoded data to decode and check for errors. Select the Hamming code variant: (7,4), (15,11), or custom.

Hamming codes add parity bits at positions that are powers of 2 (1, 2, 4, 8...). Data bits fill the remaining positions. The encoder calculates parity based on specific bit positions.

The decoder checks parity bits to detect and correct single-bit errors. If an error is found, the tool identifies and fixes the erroneous bit. Double-bit errors are detected but not corrected.

When You'd Actually Use This

Learning error correction

Hamming codes are taught in computer science courses. Work through examples to understand error detection and correction. Visual learning tool for students.

Understanding ECC memory

ECC RAM uses Hamming-like codes. Understand how memory corrects bit flips. See how parity bits protect data integrity in servers.

Designing communication protocols

Building a protocol that needs error correction? Hamming codes add minimal overhead. Good for low-error-rate channels with single-bit errors.

Simulating transmission errors

Test how Hamming codes handle errors. Encode data, flip bits, decode to see correction in action. Educational demonstration of error resilience.

Working with embedded systems

Some microcontrollers use Hamming codes for flash memory. Understand the encoding for firmware development. Debug memory corruption issues.

Analyzing data storage systems

RAID systems and SSDs use error correction. Hamming codes are foundational. Understand the principles behind more complex codes like Reed-Solomon.

What to Know Before Using

Single-bit error correction only.Hamming codes correct exactly one bit error per codeword. Two-bit errors may be detected as uncorrectable. For multiple errors, use stronger codes.

Overhead increases with protection.(7,4) code: 3 parity bits for 4 data bits (75% overhead). (15,11): 4 parity for 11 data (36% overhead). Larger blocks are more efficient.

Parity bit positions are fixed.Positions 1, 2, 4, 8... are always parity. Other positions hold data. This pattern enables error location calculation.

SECDED adds another parity bit.SECDED (Single Error Correction, Double Error Detection) adds one overall parity bit. Detects two-bit errors that standard Hamming might miss.

Pro tip: The syndrome (parity check result) directly gives the error position. Syndrome 0 means no error. Syndrome 5 means bit 5 is wrong. This elegant property makes Hamming codes efficient.

Common Questions

What does (7,4) mean?

7 total bits, 4 data bits. The remaining 3 are parity bits. Every 4 bits of data become 7 bits when encoded. 75% overhead but single-error correction.

How are parity positions calculated?

Parity bit 1 covers positions 1,3,5,7,9... Parity bit 2 covers 2,3,6,7,10,11... Each parity bit covers positions where its bit is set in the binary index.

Can it correct burst errors?

No, Hamming codes assume random single-bit errors. Burst errors (multiple adjacent bits) require interleaving or different codes like convolutional codes.

What's the minimum distance?

Hamming (7,4) has minimum distance 3. This means any two valid codewords differ by at least 3 bits. Enables single-error correction.

How does error location work?

Recalculate all parity bits. The pattern of failed parity checks forms a binary number. This number is the position of the erroneous bit.

Is Hamming code still used?

Yes, in ECC memory, some storage systems, and as a building block for more complex codes. Foundation for understanding modern error correction.

What about extended Hamming code?

Extended Hamming adds an overall parity bit. (8,4) instead of (7,4). Detects double-bit errors. Can't correct them but knows correction failed.