What is a Parity Bit?
A parity bit is a single extra bit appended to a string of binary data to enable simple error detection. It is one of the oldest and cheapest error-checking schemes, used in serial communication (UART), memory, and storage. The parity bit is chosen so that the total number of 1 bits — including the parity bit — is either always even (even parity) or always odd (odd parity).
How to Use This Calculator
Enter your binary data as a string of 0s and 1s (for example 1011010). Any characters that are not 0 or 1 are ignored. The calculator counts how many 1 bits the data contains, then reports both the even parity bit and the odd parity bit you would append.
The Formula
First count the number of 1 bits, called ones. The even parity bit is simply ones mod 2: if the data already has an even number of 1s, the parity bit is 0; if odd, it is 1, restoring an even total. The odd parity bit is the complement, 1 - (ones mod 2), which forces the overall count to be odd.
Worked Example
Take the data 1011010. The 1 bits are in positions 1, 3, 4, and 6 → there are 4 ones. Since \(4 \bmod 2 = 0\), the even parity bit is 0 (the total is already even). The odd parity bit is 1, which would make the total five 1s — an odd number.
FAQ
What error does parity catch? Parity detects any odd number of flipped bits (1, 3, 5…). It cannot detect an even number of errors, nor can it correct errors.
Even or odd parity — which is better? Neither has an error-detection advantage; the choice is a convention agreed between sender and receiver. Some systems prefer odd parity so an all-zero line is detected as an error.
Does the parity bit count itself? Yes. Parity refers to the total count of 1s in the data plus the parity bit, which is why the formula uses the data ones count.