Parity Check

A simple error detection method based on counting the number of ones.

The Simplest Form of Error Detection

Parity check is one of the oldest and simplest methods for detecting errors in data transmission. It doesn't correct errors, but it provides a basic way for the receiver to determine if a block of data has been corrupted during its journey through a communication channel. The core idea is to add one extra bit, the parity bit, to each block of data being sent.

This method adds a minimal amount of to achieve a basic level of integrity checking.

How Parity Check Works

The sender and receiver must first agree on which type of parity to use. There are two options: even parity or odd parity.

Even Parity

The goal is to ensure that the total number of '1's in the data block (including the parity bit) is an even number.

  • If the original data has an odd number of '1's, the parity bit is set to 1.
  • If the original data has an even number of '1's, the parity bit is set to 0.

Odd Parity

The goal is to ensure that the total number of '1's in the data block (including the parity bit) is an odd number.

  • If the original data has an odd number of '1's, the parity bit is set to 0.
  • If the original data has an even number of '1's, the parity bit is set to 1.

The Process in Action (Even Parity Example)

  1. Sender's side: Imagine we want to send the 7-bit ASCII code for the letter 'K', which is 10010111001011.
    • Count the '1's in 10010111001011: There are four '1's.
    • Since four is an even number, the sender sets the parity bit to 0.
    • The transmitted 8-bit block is 10010111001011 followed by 00.
  2. Receiver's side: The receiver gets the 8-bit block 1001011010010110.
    • It counts the total number of '1's: There are four '1's.
    • Since four is an even number, it matches the agreed-upon even parity. The receiver assumes the data is correct.

The Achilles' Heel: Detecting Errors

The crucial limitation of parity checking is its inability to detect an even number of bit errors. Let's see this in practice with our example (data 10010111001011, even parity bit 00, transmitted as 1001011010010110).

Scenario 1: One Bit Error (Success!)

During transmission, a single bit flips. The receiver gets 1001111010011110.

  • The receiver counts the '1's: there are now five.
  • Five is an odd number. This does not match the agreed-upon even parity.
  • Result: An error is successfully detected. The receiver knows the data is corrupt and can request a retransmission.

Scenario 2: Two Bit Errors (Failure!)

During transmission, two bits flip. The receiver gets 1000011010000110.

  • The receiver counts the '1's: there are now four.
  • Four is an even number. This matches the agreed-upon even parity.
  • Result: No error is detected, even though the data is wrong. The receiver accepts the corrupted data as valid.

Conclusion: Parity check is guaranteed to detect any odd number of errors (1, 3, 5, etc.) but will fail to detect any even number of errors (2, 4, 6, etc.).

Interactive Parity Checker

Enter a binary string (0/1 only)

Transmitted Codeword

Ones count:
4
Parity bit:
0
Parity Type:
Even

Received Codeword

Click any bit to toggle an error

Result:
OK (no error detected)
    Parity Check | Teleinf Edu