The word parity has a number of possible meanings. In the context of mathematics and computer science, it refers to whether a number (of items) is even or odd. A parity bit hence is appended to a message such that the number of bits in the message is either even or odd, depending on what the sender and receiver agreed upon. Concretely, the algorithm works as follows:

Note: An alternative manner to compute the parity is to compute the exclusive or (XOR) of all bits. This number is 0 for an even number of 1s and odd for an odd number of 1s. Thus, for even parity, a parity bit can be computed as the XOR of all bits. For odd parity, the parity bit is the XOR of all the bits flipped.