Understanding the Even Parity Bit
A parity bit is the simplest error-detecting code used in digital systems: one extra bit added to a binary word so that a receiver can tell, after transmission or storage, whether a single bit was corrupted. With even parity, the parity bit is chosen so that the total number of 1-bits in the data plus the parity bit is always an even number. If the data already has an even number of ones, the parity bit is 0; if it has an odd number of ones, the parity bit is 1 — because adding that extra 1 brings the total back to even.
The formula
For a data word with bits b1, b2, …, bn, the even parity bit P is:
- P = (number of 1-bits in the data) mod 2
- Equivalently, P = b1 XOR b2 XOR … XOR bn — XORing every bit together produces 1 exactly when the count of ones is odd, which is the same test.
The resulting codeword (data bits plus parity bit, in whichever order the protocol specifies) always contains an even number of 1s. That single invariant is what lets a receiver check the data.
Worked examples
- Data 1011001 has four 1-bits — already even — so the parity bit is 0. Appended, the codeword is 10110010, still four ones.
- Data 1101 has three 1-bits — odd — so the parity bit is 1. Appended, the codeword is 11011, now four ones (even).
- Data 0000000 has zero 1-bits — even (zero counts as even) — so the parity bit is 0.
How the check works on the receiving end
When a codeword arrives, the receiver counts the 1-bits across the whole word, including the parity bit. If that count is even, the word passes the parity check — no single-bit error was detected. If the count comes out odd, exactly one bit (or any odd number of bits) must have flipped in transit, and the receiver flags the word as corrupted. This is why even parity is described as an error-detecting, not error-correcting, code: it tells you something is wrong but not which bit to fix.
Limits of a single parity bit
A lone parity bit only catches errors that flip an odd number of bits. If exactly two bits flip at the same time, the ones count changes by an even number and the parity check still passes — the error slips through undetected. This is why real systems that need to catch more error patterns use two-dimensional parity, Hamming codes (which add enough parity bits to also locate the flipped bit), or checksums like CRC-32.