jk's blog

Parity in Computer Data, What is It?

Parity, in computer data, is a bit that’s set or unset so the total number of bits is either even or odd. It’s an extra bit, and it’s added as a check on the data. So, if the parity is not correct, you assume the data is bad.

It’s often used in data communications, and was a very visible feature during the old modem and BBS days.

Even parity means that a bit is added so the total number of “1” bits is even. Odd parity means that a bit is added so the total number of “1” bits is odd. So this:


With even parity, is: 10101001
With odd parity is: 10101000

Back in the old days, ASCII had only 7 bits. (Indeed, it actually has only 7 bits, but the 256 and larger character sets have dominated.) The 8th bit was used for parity.

Then, by the 1970s, modems with 8 data bits and a 9th parity bit were common.

The shorthand terminology that describes the number of parity and data bits, as well as stop bits, is still pretty common. A stop bit is an added bit that’s low. It’s like a pause. Here are some examples:

8N1 – 8 data bits, no parity, 1 stop bit.
7E1 – 7 data bits, even parity, 1 stop bit.
8O1 – 7 data bits, odd parity, 1 stop bit.

Parity bits are overhead, but help detect problems with the data. Of course, if the parity bit is also flipped, or two bits are flipped, the error won’t be detected. That, however, is rare, because noisy connections tend to have a lot of errors.

Also, for larger file transfers, techniques like XMODEM and Kermit were invented. They would send the data, and then calculate a checksum. If the checksum failed, then the entire block of data was bad and a resend could be requested.

Ethernet uses parity, as well as checksums.

RAID 5 uses parity, but in a different way. It uses any number of data bits, and one parity bit.

RAID 6 is like RAID 5, but adds another parity bit. This way, you can lose two drives and still recover.

Parity is sometimes misspelled “parody” by people who have poor spelling. Computer people may do the opposite, and spell parody as “parity” because they don’t see the word “parody” anywhere. The two words are pronounced similarly.