teach-ict.com logo

THE education site for computer science and ICT

Error detection and correction

3. Parity check

This uses a single bit within a data packet to try and detect an error. This is called the 'parity bit'.

A parity check can detect a single bit error in the data packet. There are two types: even parity and odd parity.

Even parity rule: Before sending (or storing) the data, count the number of '1's in the data packet, if there are an odd number then set the parity bit to 1, this ensures there are always an even number of 1s in the packet. If there are already an even number of 1s, then set the parity bit to 0.

Example

Here is the original data with the question mark indicating the parity bit position

                       1111 111?

There are seven 1s in the data, which is an odd number, therefore set the parity bit to 1 as well, like this

                       1111 1111

Now let's transmit the data and an error creeps in:

                       1011 1111

Even parity check rule is there must be an even number of 1s but that error in the second bit results in an odd number of 1s and so there must be an error in the packet.

The odd parity rule is similar, but now there must be an odd number of 1s in the data.

Parity check is simple but it is not perfect - it can't detect two bits flipping in the opposite direction as they cancel each other out. But it is still a very popular method.