#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · ENCODE AND DECODE

Hamming Code Calculator: Find and Fix a Flipped Bit

Add parity bits to your data, or find and correct a single-bit error in a codeword.

  • 🔢 Any data length
  • 🎯 Syndrome finds the bit
  • ⚖️ Even or odd parity

How to use the Hamming Code Calculator

  1. 1. Pick a modeEncode data, or check and correct a received codeword.
  2. 2. Enter the bitsAnd choose even or odd parity.
  3. 3. Read the resultParity calculations, the codeword, or the error position and fix.

How Hamming code works

Hamming code adds parity bits so that any single flipped bit can be found and fixed. For m data bits you need r parity bits, where 2^r ≥ m + r + 1: 3 parity bits for 4 data bits gives Hamming(7,4).

  • Parity bits sit at positions that are powers of 2: 1, 2, 4, 8 …; data bits fill the rest.
  • Parity bit P1 checks every position whose binary number has bit 1 set (1, 3, 5, 7 …), P2 checks positions with bit 2 set (2, 3, 6, 7 …), and so on.
  • Each parity bit is chosen so its group has an even number of 1s (or odd, with odd parity).

To check a codeword, recompute each group. Write a 1 for each failed check; read as a binary number, the syndrome is the position of the wrong bit. 0 means no single-bit error.

Worked example

Encode 1011 with even parity. The layout is P1 P2 D1 P4 D2 D3 D4, with D1–D4 = 1, 0, 1, 1:

  • P1 covers positions 3, 5, 7: 1 ⊕ 0 ⊕ 1 = 0.
  • P2 covers 3, 6, 7: 1 ⊕ 1 ⊕ 1 = 1.
  • P4 covers 5, 6, 7: 0 ⊕ 1 ⊕ 1 = 0.

The codeword is 0110011. Now suppose bit 5 flips in transit and 0110111 arrives. P1 fails, P2 passes and P4 fails, so the syndrome is 4 + 1 = 5. Flip bit 5 back to get 0110011, and the data 1011 is recovered.

With two flipped bits, plain Hamming code can't tell what happened and may "fix" the wrong bit. Adding one overall parity bit (SECDED) lets memory chips detect double errors as well.

Frequently asked questions

Where is Hamming code used?

In ECC memory, some storage systems and teaching. Modern links often use stronger codes like Reed–Solomon or LDPC.

Even or odd parity: which should I use?

Even is the textbook default. Use whichever your question states; the tool supports both.

Can it correct two errors?

No. Hamming code corrects one error. For two, you need a stronger code.

Is the hamming code calculator free to use?

Yes, the hamming code calculator is free and costs nothing. Your first calculation shows a short form for your name and WhatsApp number one time; once that's done, this tool and every other Uncodemy tool open with no form.

More free tools

See all free tools