1. Home
  2. Engineering
  3. Computer
  4. Computer Networks
  5. Hamming Code Calculator (Encode & Correct)

Hamming Code Calculator (Encode & Correct)

Hamming codeword for a data word with even parity, or find and correct a single-bit error.

Computer NetworksEngineeringIntermediateStep-by-step solution

Practice questions

Textbook-style questions. Press Solve in the tool to load the values and see the full solution. Underlined words are explained below.

  1. Find the Hamming code for the data word 1011 using even parity.

  2. The codeword 0110111 is received. Find and correct the error.

  3. Encode the 8-bit data word 10011010 with Hamming code.

Worked example

Here's the first practice question solved in full, so you can see exactly what you'll get. Try it on paper before you read the steps.

Question: Find the Hamming code for the data word 1011 using even parity.

Plan: how this problem is solved
  1. Write the given values
  2. Number of parity bits
  3. Work out each parity bit (even parity)
  4. Codeword
Answer
Hamming codeword0110011
Length4 data bits + 3 parity bits = 7 bits
Step-by-step solution
  1. Write the given values
    Encode a data word
    =1011
  2. Number of parity bits
    m = 4 data bits. The smallest r with 2r ≥ m + r + 1 is r = 3, so the codeword has 7 bits.
  3. Work out each parity bit (even parity)
    P1=checks 3, 5, 7: 2 ones → P1 = 0
    P2=checks 3, 6, 7: 3 ones → P2 = 1
    P4=checks 5, 6, 7: 2 ones → P4 = 0
  4. Codeword
    P1P2D3P4D5D6D7
    0110011
Key idea: Each parity bit checks the positions whose binary number has that bit set. When a bit flips, the failed checks add up to exactly its position.

Terms used on this page

New to a word in the question or the solution? Here it is in simple language.

Bit
A single binary digit, 0 or 1. 8 bits make one byte.

Symbols in this solver

What each box asks for, and its unit.

SymbolWhat it meansSI unit
Bits (data word or received codeword)text

Formula & concept

Build the Hamming code for a data word with even parity, or check a received codeword, find the wrong bit and correct it.

2r ≥ m + r + 1,   parity bits at positions 1, 2, 4, 8, …

Key idea: Each parity bit checks the positions whose binary number has that bit set. When a bit flips, the failed checks add up to exactly its position.

How to use this calculator

  1. Type the known values from your question and pick the unit for each one.
  2. Press Solve step by step.
  3. Read the plan first. It lists the steps the solution will follow. Want to try it yourself? Tick Practice mode and the answer stays hidden until you ask for it.
  4. Check the answer, then go through each numbered step. Where there's a second method, it's shown after the main one.
  5. Stuck on a word? The terms section explains it in simple language.

Frequently asked questions

How does the Hamming Code work?
You enter the values you know, pick their units and press Solve. The tool changes everything to SI units, applies the formula 2^r ≥ m + r + 1, parity bits at positions 1, 2, 4, 8, … and shows you each step: given data, formula, substitution and the final answer.
What is the key idea behind it?
Each parity bit checks the positions whose binary number has that bit set. When a bit flips, the failed checks add up to exactly its position.
What if my answer doesn't match my book?
First check that you've picked the right units. Then see which constants your book uses and how many figures it rounds to. You can change the number of figures under Settings in the solver. A small difference in the last digit is usually just rounding.
Can I see how to solve it without seeing the answer?
Yes. Tick Practice mode under the solver. You'll get the plan of steps only, so you can work it out on paper. One click then shows the full solution.
Is the Hamming Code free to use?
Yes, it's free with no sign-up. All calculations happen inside your browser and nothing you type is stored.
Which grades is it useful for?
It's made for Engineering (University · B.Tech · B.E. · Diploma · GATE · FE). The working follows the method used in textbooks and exams.