Parity Bit Calculator
Enter your data word, choose an input format (binary, hexadecimal, or decimal) and a parity scheme, then select whether you want to generate a new parity bit or check whether a received word already passes its parity test. The calculator shows the parity bit, the full encoded word, a step-by-step working, and explains why parity-checked data may still contain undetected errors.
What is a parity bit?
A parity bit is a single bit appended to a data word before it is stored or transmitted. Its value is chosen so that the total number of 1-bits in the combined word (data plus parity bit) satisfies a chosen rule: even parity means the total is even; odd parity means the total is odd. The receiver independently recalculates the expected parity from the received data and compares it against the received parity bit. A mismatch signals that at least one bit changed in transit. The technique is one of the oldest in computing: parity tracks appeared on magnetic tape storage as early as 1951, and it remains common in UART serial ports, ECC RAM, SCSI buses, and RAID arrays.
How even and odd parity work
For even parity, count the 1-bits in the data word. If the count is already even, the parity bit is 0; if the count is odd, the parity bit is 1, bringing the total to an even number. Odd parity is the complement: the parity bit is set so the total count of 1-bits is odd. The XOR of all data bits gives the even-parity bit directly, because XOR returns 1 when an odd number of inputs are 1. For example, for the data word 1010110, there are four 1-bits (an even count), so the even-parity bit is 0, and the encoded word is 10101100. For odd parity the bit is 1, giving 10101101. Mark parity always appends a 1 and space parity always appends a 0, making them useful for framing in legacy serial protocols rather than genuine error detection.
Limitations: what parity cannot do
A single parity bit can detect any odd number of bit flips in a word (one flip, three flips, etc.) but cannot detect an even number of simultaneous errors. If two bits flip together, the parity count returns to the expected value and the error goes undetected. Parity also cannot locate the flipped bit or correct it; it can only signal that something is wrong. For single-bit error correction, Hamming codes (such as Hamming(7,4) or SEC-DED) extend the parity idea across multiple overlapping check bits that together identify the exact bit position that changed. For burst-error detection in network packets, cyclic redundancy checks (CRC) are far more effective than parity.
Real-world applications
UART serial communication is the most common everyday encounter with parity: the UART frame contains a configurable parity bit after the data bits, typically set to even or odd, and the receiver checks it before accepting each byte. ECC (Error-Correcting Code) RAM in servers and workstations uses a more advanced extension of parity across 64-bit or 72-bit words to both detect and correct single-bit errors. SCSI parallel bus connections used odd parity over the full data bus. RAID-5 storage arrays distribute XOR-based parity blocks across multiple drives so that any one failed drive can be reconstructed from the survivors. In each case the principle is the same: store or send a concise checksum derived from the data, and recheck it on the other side.
Parity scheme comparison
| Scheme | Parity bit rule | Error detection | Typical use |
|---|---|---|---|
| Even | Make total 1-count even | Single-bit errors | UART, RAM, SCSI, PCI |
| Odd | Make total 1-count odd | Single-bit errors | Some UART configs, older hardware |
| Mark | Always 1 | None (framing aid) | Legacy serial framing, baud sync |
| Space | Always 0 | None (framing aid) | Legacy serial framing, baud sync |
Summary of the four parity schemes and their primary use cases.
Frequently asked questions
What is the difference between even and odd parity?
With even parity, the parity bit is set so the total number of 1-bits in the encoded word (data plus parity bit) is an even number. With odd parity, the bit is set so the total is odd. Both detect single-bit errors equally well. Even parity is more common in practice because a word of all zeros is a valid even-parity word, which simplifies power-on self-test logic in some hardware designs.
What are mark and space parity?
Mark parity always sets the parity bit to 1 and space parity always sets it to 0. Neither provides any real error-detection capability because the bit value never changes with the data. They are mainly found in legacy serial protocols where the ninth bit is used as a framing or address indicator rather than a checksum, and some older equipment defaults to one of them for backward compatibility.
Why can parity miss some errors?
A parity bit reflects whether the count of 1-bits is even or odd. If exactly two bits flip simultaneously, the parity count returns to its expected value even though the data is wrong. In general, parity detects an odd number of bit errors and misses an even number. For more robust protection, use a CRC (cyclic redundancy check) for link-layer data, or a Hamming/SEC-DED code for memory that also needs error correction.
Can parity correct errors, not just detect them?
No. A single parity bit only signals that an error occurred somewhere in the word; it does not indicate which bit flipped. Correction requires multiple overlapping check bits arranged so their pattern points to the faulty bit position, which is what Hamming codes achieve. ECC RAM modules use a variant called SEC-DED (Single Error Correcting, Double Error Detecting) for exactly this purpose.
How do I use this calculator in check mode?
In check mode, enter the complete received word - data bits plus the parity bit already included. The calculator counts the 1-bits in the full word and tells you whether the total satisfies the chosen parity scheme. A PASS result means no single-bit error was detected; a FAIL result means the parity rule is violated and at least one bit has changed.
How is the parity bit calculated using XOR?
For even parity, XOR all the data bits together. The XOR of a set of bits is 1 when an odd number of them are 1, and 0 otherwise, which is exactly the even-parity bit. For example, XOR of 1, 0, 1, 0, 1, 1, 0 is 0 (four 1-bits, so no extra 1 needed). For odd parity, XOR all data bits and then flip the result.