Parity Bit
XOR of data bits used for error detection.
Formula
Variables
Example
Detects single-bit errors
How it works
A parity bit is computed by XOR-ing all the data bits together, which produces a single extra bit that summarizes whether the number of 1s in the data is odd or even. This works because XOR flips whenever it sees a 1, so the final result is 1 exactly when there are an odd number of 1s, and 0 when there are an even number of 1s. When the receiver XORs the received data and parity bit again, any odd number of bit flips changes the result, revealing that an error likely occurred.
When to use it
Use a parity bit in simple communication or storage systems where you want lightweight error detection with almost no extra computation. It is common in basic serial links, memory checks, and teaching examples, but it cannot correct errors and misses some multi-bit changes.
Worked example, step by step
Data bits: b1 = 1, b2 = 0, b3 = 1, b4 = 1 Compute the parity bit: p = b1 ⊕ b2 ⊕ b3 ⊕ b4 p = 1 ⊕ 0 ⊕ 1 ⊕ 1 Step 1: 1 ⊕ 0 = 1 Step 2: 1 ⊕ 1 = 0 Step 3: 0 ⊕ 1 = 1 Final answer: p = 1 So the parity bit is 1, making the total number of 1s in the transmitted message even.
Common mistakes to avoid
- Assuming parity can fix errors instead of only detecting them
- Forgetting that XOR is order-independent and just counts 1s modulo 2
- Using the wrong parity convention and mixing up even parity with odd parity
Did You Know?
A single parity bit can detect an error but not fix it, the simplest form of error checking.
Share this formula
More in Computer Science
View allShannon Entropy
AdvancedAverage information content of a random source (bits).
Master Theorem (form)
AdvancedAnalyzes running time of divide-and-conquer algorithms.
Hamming Distance
AdvancedNumber of positions at which two strings differ.
Bits to Represent n
BasicMinimum number of bits to represent n distinct values.
Binary to Decimal
BasicConverts a binary number to decimal.
Nodes in a Full Binary Tree
IntermediateTotal nodes in a perfect binary tree of height h.