Error correcting codes: Hamming Code

  1. Hamming code is given by RW Hamming
  2. It is one of the most common error correcting codes used in Random Access Memory (RAM).

How does Hamming Code work?

  1. Suppose there is a message of n bits.
  2. We add k number of parity bits to the message.
  3. This changes the size of the message from n bits to n+k bits.
  4. The bit positions are numbered in sequence from 1 to (n+k).

for example if message length (n) is = 8, and number of parity bits (k) = 4 than total number of bits in hamming code will be (n+k) = (8+4) = 12bits

1    2    3    4    5    6    7    8    9    10    11    12

  1. Those positions numbered as a power of 2 are reserved for the parity bits and the remaining bits are data bits. See below, the bits marked as red are reserved for parity bits.

1    2    3    4    5    6    7    8    9    10    11    12

How to calculate the number of parity bits (k)?

The number of parity bits can be calculated by the following relationship

 2^k - 1 \ge n + k

if the length of a message is 8 i.e. n = 8 then the value of k can be 4 or greater than 4.

Q. Obtain hamming code for the given 8-bit data 01011011

How's this tutorial?
I can live without food but I can't live without teaching. I passionate about my profession. Raj Kumar Thenua, M.Tech in Digital Communication, GATE 2015 & NET 2014 Qualified, currently working as an Assistant Professor at Anand Engineering College, Agra. He has an experience of approx 10 years in academics. The areas of interest are Communication, Signal Processing, and Adaptive filters. He has received a “Shrestha Shikshak Puruskar” by Sharda Group of Institutions (SGI) in the year 2009-10 for outstanding academic performance He has the knowledge of various Engineering simulation software’s mainly MATLAB, Simulink, IE3D, Scilab, Code composer Studio. He is the active member of IETE, ISTE, IAENG, IACSIT, UACEE.


Please enter your comment!
Please enter your name here