About the Odd Parity Bit Calculator
A parity bit is a single extra bit added to a block of binary data as a simple error-detection check. With odd parity, the bit is chosen so that the total number of 1s in the data plus the parity bit is always odd. This calculator counts the 1-bits in whatever binary string you enter, works out the parity bit that keeps the total odd, and shows the complete codeword you would actually transmit or store.
The odd parity rule
The rule has only two cases:
- If the data has an even number of 1-bits, the odd parity bit is 1 (an even count plus 1 becomes odd).
- If the data has an odd number of 1-bits, the odd parity bit is 0 (the data is already odd, so no change is needed).
Equivalently, the parity bit is the logical complement (NOT) of the XOR of every data bit. XOR-ing all the bits together gives 0 when there is an even number of 1s and 1 when there is an odd number of 1s -- that result is the even-parity bit. Odd parity simply flips it.
Worked example
Take the 7-bit ASCII code for the letter "A", 1000001. It contains two 1-bits, which is even, so the odd parity bit is 1. Appending it gives the 8-bit codeword 10000011, which now has three 1-bits -- an odd total, as required.
Now take the ASCII code for "C", 1000011. It contains three 1-bits, already odd, so the parity bit is 0. Appending it gives 10000110, still three 1-bits in total -- odd, and correct, even though the added bit itself was a 0.
Where the parity bit goes
The parity bit can be placed on either side of the data -- appended after the last data bit or prepended before the first one. Either placement produces the same count of 1s and satisfies the same odd-parity rule; what matters is that the sender and receiver (or the two ends of your calculation) agree on the same convention, since a bit in the wrong position will be read as part of the data instead of as the check bit.
What parity can and cannot catch
A parity check is inexpensive and easy to compute, which is why it was widely used in early serial links (such as the classic RS-232 "7O1" configuration: 7 data bits, odd parity, 1 stop bit) and in simple memory and storage checks. It reliably catches any error that flips an odd number of bits, because flipping an odd number of bits always changes the ones-count from odd to even or back. It misses errors that flip an even number of bits (two flipped bits cancel out and the parity still checks out), and even when it does catch an error, a single parity bit can only report that something is wrong -- it cannot say which bit is wrong or fix it. Systems that need to detect larger error patterns or correct errors outright use stronger schemes such as CRC checksums or Hamming codes instead.