Hamming Code Calculator — Parity Bits & Error Correction
Hamming codes add redundant parity bits to data so that single-bit transmission errors can be automatically detected and corrected. Enter your data width and mode to find the minimum parity bits required.
Error-correction mode
Minimum redundant bits needed to protect your data
- 1
SEC condition: 2^r ≥ m + r + 1
2^4 = 16 ≥ 8 + 4 + 1 = 13 = 16 - 2
Total codeword bits = m + r
8 + 4 = 12 - 3
Parity bits required
4Minimum r satisfying 2^r ≥ m + r + 1, found by testing r = 1, 2, 3, …
How does this calculator work?
Find the minimum parity bits r for a Hamming error-correcting code: r satisfies 2^r ≥ m + r + 1 for SEC (corrects 1-bit errors) or uses r+1 bits for SEC-DED (also detects 2-bit errors). Total codeword = m + r bits. Efficiency = m / (m + r).
Formula
How this is calculated
A Hamming code places parity bits at power-of-two positions within the codeword. Each parity bit covers a specific subset of data-bit positions; together they form a binary syndrome that pinpoints the exact location of any single flipped bit, allowing automatic correction. The minimum number of parity bits r satisfies 2^r ≥ m + r + 1 for single-error-correction (SEC), where m is the number of data bits.
SEC-DED (Single Error Correction, Double Error Detection) adds one extra overall parity bit over the entire codeword, raising the minimum Hamming distance from 3 to 4. This lets the receiver distinguish between a single correctable error (odd syndrome parity) and a double uncorrectable error (even syndrome parity), making it the standard choice in DRAM ECC memory.
Code efficiency (m / total) shows the fraction of the codeword that carries useful data. For small m the overhead is high — 4 parity bits for 8 data bits (33 % overhead) — but improves as m grows: 10 parity bits protect 1000 data bits (1 % overhead). The calculator assumes a binary linear code with no burst-error protection; for burst errors, interleaved or Reed-Solomon codes are more appropriate.
Frequently asked questions
Four parity bits (r = 4) satisfy 2^4 = 16 ≥ 8 + 4 + 1 = 13, giving a 12-bit codeword for SEC. Adding one SEC-DED overall parity bit makes it 13 bits total.
SEC (Single Error Correction) has a minimum Hamming distance of 3, so it can correct any 1-bit error. SEC-DED adds an extra parity bit to reach distance 4, allowing it to also detect (but not correct) 2-bit errors — the standard in ECC RAM.
No. Standard Hamming codes correct only isolated single-bit errors. Burst errors (consecutive flipped bits) require interleaved Hamming codes or stronger codes like Reed-Solomon, which are used in storage devices and optical media.
Also known as
TG we-Calculate Editorial Team. (2026). Hamming Code Calculator — Parity Bits & Error Correction [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/hamming-code-calculator
TG we-Calculate Editorial Team. "Hamming Code Calculator — Parity Bits & Error Correction." TG we-Calculate. 2026. https://we-calculate.com/calculator/hamming-code-calculator.
TG we-Calculate Editorial Team, "Hamming Code Calculator — Parity Bits & Error Correction," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/hamming-code-calculator
@misc{wecalculate_hamming_code_calculator, title = {Hamming Code Calculator — Parity Bits & Error Correction}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/hamming-code-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
