Saved

Press the star next to a tool's name to save it.

All my tools

Parity Bit Calculator

Use this parity bit calculator to find the even or odd parity bit of a bit string, check a received word for errors, and XOR rows of bits as RAID parity does.

Restored your last values ·

Enter your data bits to get the parity bit, which is added at the end of the word. Choose even or odd parity. Or enter a received word, with its parity bit, to check it. The XOR option combines several rows, as RAID parity does.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Choose what you want, enter the bits, then press Calculate.

A parity bit calculator finds the extra bit that makes the number of ones in a word even or odd, and checks a received word. Enter your data bits, such as 1011, choose even or odd parity, and you get the parity bit and the full word. A second mode checks whether a word still has the right parity, and a third combines several rows with XOR, which is how RAID parity works. It runs in your browser.

How to use the parity bit calculator

  1. Choose find the parity bit, check a received word or XOR rows.
  2. Choose even or odd parity.
  3. Enter the bits, or the rows of bits.
  4. Press Calculate.

Even and odd parity

The Wikipedia article on the parity bit explains that with even parity the bit is selected so that the total number of set bits, including the parity bit, is even. If the data has an odd number of ones, the parity bit is 1. With odd parity, the rule is reversed and the total is odd.[1] The page's examples are: for even parity, 1001 gets the parity bit 0 and is sent as 10010, and 1011 gets 1 and is sent as 10111. For odd parity, 1001 gets 1 and is sent as 10011, and 1011 gets 0 and is sent as 10110.[1] The calculator gives the same results, and shows how many ones there are in the data.

A table of 8-bit examples

The page also has a table of 8 bits of data. For 00000000, which has no ones, the even word is 000000000 and the odd word is 000000001. For 10010001, which has 3 ones, they are 100100011 and 100100010. For 01101001, with 4 ones, they are 011010010 and 011010011. For 11111111, with 8 ones, they are 111111110 and 111111111.[1] You can enter any of these to check the calculator.

How parity is computed

The page says that the parity can be computed as a sum modulo 2, for example 1 + 0 + 0 + 1 (mod 2) = 0, or with the exclusive or, 1 ⊕ 0 ⊕ 0 ⊕ 1 = 0. It also notes that an XOR of several inputs is true if and only if an odd number of its inputs are true, so XOR logic is equal to even parity.[1] In other words, the even parity bit of the data is the XOR of all its bits. The calculator counts the ones and works out the same bit.

What parity can detect

The article says that parity detects an odd number of bit errors, so every single-bit error is caught. An even number of errors goes unseen. Its example is the even-parity word 10010 received as 11011, with two bits flipped, which still has an even number of ones and so passes the check.[1] Parity also cannot correct anything. The page says that the data must be discarded entirely and retransmitted from scratch.[1] The check mode of the calculator reports the number of ones and whether the parity is right, and it reminds you of these limits.

XOR parity in RAID

The same idea works on whole rows of bits. The page's example for RAID 4 has a first drive holding 01101101 and a second holding 11010100, so the parity drive holds the bit-by-bit XOR, 10111001. If the second drive is lost, its data is rebuilt by XORing the first drive with the parity: 01101101 XOR 10111001 gives 11010100.[1] Enter the rows into the XOR mode, one per line, and the calculator returns the parity row. To rebuild a lost row, enter the parity row and all of the rows that remain.

A byte worked through

Take the byte 01001010, which has three ones. For even parity the bit must be 1, so the word is 010010101, which has four ones. For odd parity the bit is 0, and the word is 010010100, which keeps three ones. If one bit of the even word changes in transit, the count of ones becomes odd, and the check mode reports an error. If two bits change, the count stays even, and the error is missed. Try these in the calculator to see each case.

Where parity bits are used

Serial links, such as the old serial port, often add a parity bit to each character, and some memory and bus systems keep a parity bit for each byte to catch single-bit faults. Parity is cheap, because it needs one extra bit and one XOR, but it only detects. When errors must be corrected, systems use codes with more check bits, such as Hamming codes, which can find the position of a wrong bit.

Choosing even or odd

The choice is a convention that the sender and the receiver agree on. Even parity is the more common, and it has the property that an all-zero word is valid. Odd parity has the property that an all-zero word is not, which can help to show that a line has failed and is stuck at zero. Whichever you choose, both ends must use the same one, or every word will look wrong.

Common mistakes

  • Mixing up even and odd. Even means an even number of ones in the whole word, parity bit included.
  • Leaving the parity bit out when checking. Check the whole received word.
  • Expecting correction. Parity only detects an odd number of errors.
  • XORing rows of different lengths. They must match bit for bit.

What next

Use this often? Add Parity Bit to your Home screen.

Frequently asked questions

What is a parity bit calculator?

A tool that finds the extra bit that makes the number of ones in a word even or odd, and checks whether a word has the right parity.

How is an even parity bit found?

Count the ones in the data. If the count is odd, the parity bit is 1, and if it is even, the bit is 0, so the total is even.

What is the even parity bit of 1011?

1, because 1011 has three ones. The word becomes 10111.

What errors can a parity bit detect?

Any odd number of flipped bits. An even number of flipped bits goes undetected, and parity can't correct errors.

How does RAID use parity?

The parity drive holds the XOR of the data drives. A lost drive is rebuilt by XORing the parity with the surviving drives.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools