A parity bit is a binary digit (bit) that is added to data to make the number of 1’s either even (in even parity) or odd (in odd parity). It’s a simple error detection scheme to check the integrity of data.

How It Works:

Even Parity:

• If the number of 1’s in a given set of data is odd, the parity bit is set to 1.
• If the number of 1’s is even, the parity bit is set to 0.
• This ensures that the total number of 1’s, including the parity bit, is always even.

Odd Parity:

• If the number of 1’s in a given set of data is even, the parity bit is set to 1.
• If the number of 1’s is odd, the parity bit is set to 0.
• This ensures that the total number of 1’s, including the parity bit, is always odd.

Usage:

• When data is transmitted or stored, a parity bit is added based on the original data.
• When the data is read or received, the parity is checked. If it doesn’t match the expected even or odd parity, an error is detected.

Example:

Let’s consider a byte of data: 11010101.

• For even parity, since there are 5 ones in the data, the parity bit would be set to 1 to make the number of ones even (total 6 ones). The transmitted byte would be: 110101011.
• For odd parity, the parity bit would be set to 0 (because there are already an odd number of ones). The transmitted byte would be: 110101010.