Odd Parity Bit Calculator

Enter a binary string to compute its odd-parity bit, the full codeword, and the ones count -- so the total number of 1s (data plus parity) always comes out odd.

Quick Facts

Rule
Total ones (data + parity) must be odd
Parity bit = 1 when the data has an even number of 1s; parity bit = 0 when the data already has an odd number of 1s.
Detects
Any single-bit (odd-count) error
Cannot detect errors that flip an even number of bits, and cannot correct any error -- only flag it.

Your Results

Calculated
Ones in data
-
Count of 1-bits before parity
Odd parity bit
-
Bit added to make the total odd
Full codeword
-
Data bits plus parity bit
Total ones (check)
-
Always odd for valid odd parity

Ready

Enter a binary string and choose where the parity bit goes.

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.

Frequently Asked Questions

How is the odd parity bit calculated?
Count the number of 1s in the binary data. If that count is even, the odd parity bit is 1, making the total number of ones (data plus parity) odd. If the count is already odd, the parity bit is 0, since the data alone already has an odd number of ones.
What is the difference between odd and even parity?
Both add one extra bit to a binary word for basic error detection. Even parity sets the extra bit so the total number of 1s is even; odd parity sets it so the total is odd. The receiver applies the same rule on arrival, and a mismatch signals a transmission error.
What errors can a single parity bit detect?
A parity bit reliably detects any error that flips an odd number of bits, because that always changes whether the total count of ones is odd or even. It cannot detect errors that flip an even number of bits, and it cannot correct an error once found -- only signal that one occurred.
Why is it called odd parity instead of even parity?
The name describes the target total count of 1-bits after the parity bit is added: odd parity always leaves an odd total, even parity always leaves an even total. Sender and receiver must agree on the same convention, since checking odd-parity data against an even-parity rule (or vice versa) will flag every message as an error.