# Parity bit

A **parity bit**, also known as a **check bit**, is a single bit that can be appended to a binary string. It is set to either **1** or **0** to make the total number of **1**-bits either even ("even parity") or odd ("odd parity").

The purpose of a parity bit is to provide a simple way to check for errors later. When data is stored or transferred electronically, it's not uncommon for bits to "flip" — change from a 1 to a 0, or vice versa. Parity checks can detect these errors. For example, to check a binary sequence with even parity, the total number of ones can be counted. If the number of ones is not even, an error is likely to have occurred.

The inherent weakness in this type of error checking is that it can only detect an odd number of errors in the sequence. If an even number of bits are flipped, a parity check will not catch it.

## Example parity checking process

- The data
**10101**is given the**even parity bit**of**1**, resulting in the bit sequence**101011**. - This data is transferred to another computer. In transit, the data is corrupted, and the computer receives the incorrect data
**100011**. - The receiving computer computes the parity:
**1**+**0**+**0**+**0**+**1**+**1**=**3**. It then performs**3**modulo**2**(the remainder of 3 divided by 2), expecting the result**0**which would indicate that the number is even. - Instead, it receives the result
**3**modulo**2**=**1**, indicating that the number is odd. Because it is looking for numbers with even parity, it asks the original computer to send the data again. - This time, the data comes through with no errors:
**101011**. The receiving computer calculates**1**+**0**+**1**+**0**+**1**+**1**=**4**. **4**modulo**2**=**0**, indicating even parity. The parity bit is stripped from the end of the sequence, and the data**10101**is accepted.

Check bits, Hardware terms, Mark parity, Parity check, Space parity