# How is a parity bit calculated

## Parity check

### General

The parity check is a simple, but very common check method, but without the possibility of correction. The parity bit - i.e. a check digit - is calculated for each byte and transmitted together with the byte. Since nine bits per byte are transmitted, the sender and receiver not only have to agree beforehand whether but also which parity check - even or odd - should be carried out.

lengthstructure
9 bit

### Check digit

Even parity
A byte has to be supplemented by a ninth bit in such a way that an even number of bits is 1 of all nine bits.
Calculation by forming the cross sum using modulo 2 or by combining the individual bits.
Odd parity
A ninth bit must be added to a byte in such a way that an odd number of bits is 1 out of all nine bits.
 0 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 010000010

The odd parity is obtained by inverting even parity (here: 010000011)

### Remarks

The disadvantage of the parity check is its low error detection rate. For example, byte 01010101 also results in even parity 0. Due to two errors, the A (01000001) has become a U (01010101) without this being able to be determined from the parity.

In general terms, this means that an even number of errors cancel each other out and only an odd number of errors changes the parity.