# Parity Calculator

Parity is not as straightforward as it sounds: our parity calculator will explain this concept in the many fields it appears! Keep reading this oddly specific article to find things you didn't even know you wanted to discover. Here you will learn:

**What is parity**?- The
**types of parity**; - Parity across
**number bases**; - How to calculate parity: binary and decimal cases;
- Parity in
**computer science**; - How to calculate the parity of a message.

## What is parity? A mathematical definition

Parity in mathematics is both a trivial and a surprisingly complex concept. There are only two types of parity, and you know them:

- Even parity; and
- Odd parity.

By definition, an **even number is divisible by two**, while this doesn't apply to odd numbers. How do we write this in mathematical language? It... depends!

But why do we care about parity? Interesting question. In your daily life, the applications of this concept are never too technical. With an even number of people, you can create pairs without leaving anyone behind, and odd numbers of sets prevent matches from ending in a draw.

For mathematicians, the story is slightly different. After disregarding parity for some years during their studies, they return to this seemingly simple concept in highly theoretical applications where the evenness or oddity (we love this word!) of a number has significant consequences, for example, in game theory or group theory. We don't need to give examples here. Or maybe just one!

A $3\times3$ Rubik's cube has always a straightforward solution. This is not true for a $4 \times4$ Rubik's cube, where you can find yourself at the very last stages of the solution with a particular single pair of tiles out of place. This issue is due to the even length of the sides!

## How to calculate parity: binary and decimal parity

To calculate parity, look at your number's ending. But what to look for depends on the base in which you are writing your number.

#### Parity in base $10$

To calculate parity in base $10$, we check if the last digit is divisible by $2$. The corresponding mathematical operation is the **modulo operation**. If you want to learn more, visit our modulo calculator.

Take your number $n$, and calculate:

And check the result:

To determine the parity of a decimal number (a number in base ten), you can also remember the possible last digits that make it even:

We are mostly interested in another base: $2$. Let's discover how to calculate parity in binary numbers.

#### How to calculate binary parity

To calculate binary parity, you really just need to glance at your number. First, convert your number in base $2$. You can easily do it at Omni's binary converter. Then look at the last digit:

- If the last digit is $0$ the number is
**even**. - If the last digit is $1$ the number is
**odd**.

🔎 Parity is conserved with respect to change in number base: an even number in base $10$ remains even in base $2$.

This rule is easy to prove by looking at how numbers behave in base $2$. Starting from $0$, we find:

As you can see, the last digit alternates between $1$ and $0$.

Now, let's take a look at parity in computer science.

## Parity in computer science

In computer science, parity has a slightly different meaning than in mathematics. Since computers think in binary, we don't have to think about division by $2$ or other operations. Instead, the concept of parity in your laptop has something to do with the **number of ones** in a binary string.

- We say that a binary number has
**even parity**if the number of $1$ it contains is**even**. - A binary number has
**odd parity**if the number of $1$ it contains is**odd**.

Notice two things out of this definition:

- We don't say that the number
**is**even or odd, but that it**has**even parity or odd parity. The number itself can be odd and have even parity; these are two separate concepts! - The number of $0$s doesn't affect the overall parity of the number!

There is no mathematical rule to calculate the parity of a number; we need to rely on a tally of the $1$s done the old way — counting — or performed by a computer.

Why do we need parity? We use this concept as a rudimentary procedure to check the correctness of a message. How? Check our other parity calculators to learn the most elementary error correction routine! Check Omni's parity tools:

- The parity bit calculator;
- The odd parity calculator; and
- The even parity calculator.

## FAQ

### How do I check if a number is even or odd?

To check if a number `n`

is even or odd, follow these easy steps:

- Take your number and divide it by
`2`

. - Look at the result:
- If the result is an integer number, the original number is even.
- If the result has a decimal part, the original number is odd.

- Alternatively, look at the last digit in your number:
- If it is
`0,2,4,6,8`

, your number is even. - If it is
`1,3,5,7,9`

, your number is odd.

- If it is

### Is zero even or odd?

**Zero is an even number** because it can be divided by two with no remainder, so it satisfies the definition of an even number. The fact that zero is divisible by every other (non-zero) number as well has no importance here.

### How do I calculate the parity of a binary message?

To calculate the parity of a binary message:

- Make sure your message is in base 2: only
`0`

s and`1`

s are allowed! - Count the occurrences of
`1`

in your message:- If the number of
`1`

s is even, the message has even parity. - If the number of
`1`

s is odd, the message has odd parity.

- If the number of

Remember that an odd binary number can have even parity and vice-versa!

### What is the parity of the message 11001001?

The message `11001001`

has even parity. To compute the parity of this message, we counted the number of ones: this digit occurs four times in the message.

Notice that the message has the least significant bit (the rightmost bit) equal to `1`

. So this is an odd number! Parities in the mathematical sense and in the informatical sense don't always coincide.