# Parity Calculator

Created by Davide Borchia
Reviewed by Anna Szczepanek, PhD
Last updated: Feb 02, 2023

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:

$n\ \mathrm{mod}\ 2$

And check the result:

$n\ \mathrm{mod}\ 2 =\begin{cases}0\ \mathrm{if\ }n\mathrm{\ is\ even}\\1\ \mathrm{if\ }n\mathrm{\ is\ odd}\end{cases}$

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:

$2,4,6,8,\ \mathrm{and}\ 0$

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:

$1, 10, 11, 100, 101, 110, 111,...$

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:

## 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:

1. Take your number and divide it by 2.
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.
3. 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.

### 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:

1. Make sure your message is in base 2: only 0s and 1s are allowed!
2. Count the occurrences of 1 in your message:
• If the number of 1s is even, the message has even parity.
• If the number of 1s is odd, the message has odd parity.

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.

Davide Borchia
Type of parity:
Mathematics
Number base
10
Number
People also viewed…

### BPM

The BPM calculator converts between beats per minute and beat duration. It also determines notes duration.

### Coffee kick

A long night of studying? Or maybe you're on a deadline? The coffee kick calculator will tell you when and how much caffeine you need to stay alert after not sleeping enough 😀☕ Check out the graph below!

### Flat vs. round Earth

Omni's not-flat Earth calculator helps you perform three experiments that prove the world is round.

### Resolution scale

The resolution scale calculator helps you measure your digital resolution's up-scaled or down-scaled values while maintaining the original aspect ratio.