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.
Parity Bit Results for Common Inputs
The parity bit is computed from the count of 1s in the data: \(P_{\text{even}} = (\text{count of 1s}) \bmod 2\) and \(P_{\text{odd}} = 1 - P_{\text{even}}\). In the codewords below the parity bit is appended as the last (rightmost) bit; some protocols place it elsewhere, but the parity value is the same.
| Data bits | Count of 1s | Even parity bit | Odd parity bit | Even-parity codeword | Odd-parity codeword |
|---|---|---|---|---|---|
| 0000000 (no ones) | 0 | 0 | 1 | 00000000 | 00000001 |
| 1111111 (all ones) | 7 | 1 | 0 | 11111111 | 11111110 |
| 1011010 | 4 | 0 | 1 | 10110100 | 10110101 |
| 1000001 | 2 | 0 | 1 | 10000010 | 10000011 |
| 1010101 | 4 | 0 | 1 | 10101010 | 10101011 |
| 1000001 (ASCII 'A', decimal 65) | 2 | 0 | 1 | 10000010 | 10000011 |
| 1000011 (ASCII 'C', decimal 67) | 3 | 1 | 0 | 10000111 | 10000110 |
| 11001110 (8-bit example) | 5 | 1 | 0 | 110011101 | 110011100 |
Worked example for the 8-bit row: the data 11001110 contains \(1+1+0+0+1+1+1+0 = 5\) ones, so \(P_{\text{even}} = 5 \bmod 2 = \) 1 and \(P_{\text{odd}} = 1 - 1 = 0\). Appending the even parity bit gives 110011101, which has 6 ones (an even total).
Interpreting the Parity Result
The parity bit is added by the sender so the receiver can run a simple check. The receiver counts the 1s over the data and the parity bit together:
- Even parity: the total number of 1s must be even.
- Odd parity: the total number of 1s must be odd.
If the total has the wrong parity, an odd number of bits (1, 3, 5, …) was flipped in transit or storage, and the data should be treated as corrupted. If the parity matches, the data is not guaranteed to be correct: an even number of flipped bits (for example two) leaves the parity unchanged and goes undetected.
Parity provides detection only. It cannot tell you which bit is wrong, so it cannot correct the error; the usual response is to discard the data or request a retransmission.
Typical use: UART serial frames
Serial settings are often written as data bits, parity, stop bits. 7E1 means 7 data bits, even parity, 1 stop bit; 7O1 means 7 data bits, odd parity, 1 stop bit; 8N1 means 8 data bits, no parity, 1 stop bit (the most common modern setting). With 7-bit ASCII, the parity bit fills the eighth bit position of the byte.
Compared with stronger methods
- Checksums and CRC use several check bits computed over a whole block, so they catch many more error patterns, including most burst errors, that single-bit parity would miss.
- ECC memory uses codes such as Hamming-based SECDED, which can correct a single-bit error and detect double-bit errors, going beyond parity's detect-only ability at the cost of more check bits.
Parity is cheap, fast and fine for low-error links, but use a CRC or ECC when reliability matters.
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.