A parity bit is a bit, with a value of 0 or 1, that is added to a block of data for error detection purposes. It gives the data either an odd or even parity, which is used to validate the integrity of the data.
Parity bits are often used in data transmission to ensure that data is not corrupted during the transfer process. For example, every 7 bits of data may include a parity bit (for a total of 8 bits, or one byte). If the data transmission protocol is set to an odd parity, each data packet must have an odd parity. If it is set to even, each packet must have an even parity. If a packet is received with the wrong parity, an error will be produced and the data will need to be retransmitted.
The parity bit for each data packet is computed before the data is transmitted. Below are examples of how a parity bit would be computed using both odd and even parity settings.
While parity checking is a useful way validating data, it is not a foolproof method. For instance, the values 1010 and 1001 have the same parity. Therefore, if the value 1010 is transmitted and 1001 is received, no error will be detected. This means parity checks are not 100% reliable when validating data. Still, it is unlikely that more than one bit will be incorrect in a small packet of data. As long as only one bit is changed, an error will result. Therefore, parity checks are most reliable when using small packet sizes.