This modulo calculator is a handy tool for finding the result of modulo operations. All you have to do is input the initial number x and integer y to find the modulo number r according to the equivalence x mod y = r. Read on to discover what exactly the modulo operations are, how to calculate modulo and how to use this calculator correctly.

What are modulo operations?

Imagine a clock hanging on the wall. Let's say it is late at night - 11 pm 🕚. You wonder what will be the time when you wake up after 8 hours of sleep. You can't just add 8 to 11, as there is no such time as 19 am. What you do, is performing a modulo operation (mod 12) - you add these two numbers, and keep subtracting 12 until you get a number lower than 12. In this case, 7. You just calculated you will wake up at 7 am 🕖.

Modulo operations in the case of the clock are so intuitive we don't even notice them. In mathematics, there are many types of more elaborate modulo operations that require more thought. We can write down that

x mod y = r

is true if there exists such an integer q (called quotient) that

y * q + r = x.

Otherwise, the number r is the remainder of division, where x is the dividend, and y is the divisor.

If the modulo definition doesn't appeal to you and you're still unsure how to calculate modulo, have a look at the next paragraph, and everything should be clear in a blink.

What is modulo congruence?

Two numbers a and b are said to be congruent modulo n when their difference a - b is integrally divisible by n (so (a - b) is a multiple of n).

Mathematically, modulo congruence formula is written as:

a ≡ b (mod n)

and n is called the modulus on congruence.

Alternately, you can say that a and b are said to be congruent modulo n when they both have the same remainder when divided by n

a mod n = r

b mod n = r

where r is a common remainder.

So, to put it simply - modulus congruence occurs when two numbers have the same remainder after the same divisor, so for example: 24 modulo 10 and 34 modulo 10 give the same answer: 4. Therefore 24 and 34 are congruent modulo 10.

Let's take a look on another example:

9 ≡ 21 (mod 6),

because 21 - 9 = 12 is a multiple of 6. It can be also written in short as 6 | (21 - 9). Or, equivalently, 21 and 9 have the same remainder when we divide them by 6:

9 mod 6 = 3

21 mod 6 = 3

How to calculate the modulo - an example

It's not a difficult task to calculate a modulo by hand. Just follow the steps below!

  1. Start with choosing the initial number (before performing the modulo operation). Let's say it is 250. It's our dividend.
  2. Choose the divisor. Let's choose it as 24; we will be hence calculating the value of 250 mod 24 (250 % 24 if using different convention).
  3. Divide one number by the other, rounding down: 250 / 24 = 10. This is the quotient. Also, you can think of that operation as an integer division - the type of the division, where we don't care about fractional part of the result.
  4. Multiply the divisor by the quotient. So it's 10 * 24 = 240 in our example.
  5. Subtract this number from your initial number - dividend. Here: 250 - 240 = 10.
  6. The number you obtained is the result of modulo operation. We can write it down as 250 mod 24 = 10.

How to use our mod calculator? 10 mod 3 and other modulo examples

Determining a modulo with our tool is easy and convenient. To find the result of modulo operations between integer numbers you need to:

  1. Type the initial number - dividend - into the first box. Let's take the example from the one of previous paragraphs, so enter 250.
  2. Enter the divisor. It's 24 in our case.
  3. Tadaaam! Our modulo calculator is showing the result - the remainder! And that's not a surprise, it's equal to 10 - the same number as we calculated before.

Below you'll find some typical queries concerning modulo.

  • 1 mod 1 = 0 (as mod 1 is always 0)
  • 1 mod 2 = 1
  • 1 mod 3 = 1
  • 5 mod 2 = 1
  • 5 mod 3 = 2
  • 6 mod 3 = 0
  • 7 mod 3 = 1
  • 10 mod 3 = 1
  • 18 mod 3 = 0
  • 100 mod 3 = 1
  • 100 mod 7 = 2

If you don't see the one you want to find, don't hesitate and just use our modulo calculator!

Modular arithmetics

Modular arithmetics is, generally speaking, an arithmetic system for integers, where numbers "wrap around" a certain number. Let's sum up what we've learned about different representations of modulo operations - all those statements below are equivalents:

  • A ≡ B (mod C)
  • A mod C = B mod C
  • C | (A - B)
  • A = B + K * C where K is a some integer

We can also perform calculations on modulo operations, like:

1. Modular addition and subtraction

(A + B) mod C = (A mod C + B mod C) mod C

(A - B) mod C = (A mod C - B mod C) mod C

So, the modulo of the sum of two numbers is equal to the sum of modulo of those numbers calculated separately, and then modulo divisor. The first stage is made to get rid of the quotient part, and then the mod operation is used again. Have a look at the example:

  • A = 11, B = 7, C = 4

    (11 + 7) mod 4 = (11 mod 4 + 7 mod 4) mod 4

    left part of the equation: (11 + 7) mod 4 = 18 mod 4 = 2

    right part of the equation: (11 mod 4 + 7 mod 4) mod 4 = (3 + 3) mod 4 = 6 mod 4 = 2

Analogically, you can show the calculations for subtraction.

2. Modular multiplication

(A * B) mod C = (A mod C * B mod C) mod C

Such an equation may be useful when the numbers are big and we don't know the modulo of that large number instantly. Let's have a look at the same example (A = 11, B = 7, C = 4) - do you know on the spot the result of 77 mod 4? Sounds like 11 mod 4, 7 mod 4 and 9 mod 4 are easier to calculate:

  • (11 * 7) mod 4 = (11 mod 4 * 7 mod 4) mod 4

    left part of the equation: (11 * 7) mod 4 = 77 mod 4 = 1

    right part of the equation: (11 mod 4 * 7 mod 4) mod 4 = (3 * 3) mod 4 = 9 mod 4 = 1

3. Modular exponentiation

A^B mod C = ( (A mod C)^B ) mod C

This formula is even more useful when dealing with large numbers. Considering the same example:

  • (11 ^ 7) mod 4 = ((11 mod 4)^7) mod 4

    left part of the equation: (11 ^ 7) mod 4 = 19487171 mod 4 = 3

    right part of the equation: ((11 mod 4)^7) mod 4 = (3^7) mod 4 = 2187 mod 4 = 3

The usefulness of the formula may be not so obvious at this example, as we still need to use the calculator to find the exponentiation result (assuming that you don't know the result of 3^7 immediately). So have a look at another problem: we want to calculate the A^B mod C for large values of B - like, e.g. 100. But, unfortunately, our calc can't handle such big numbers as the device encounter the problem of overflow, only numbers till 2^60 can be held. You can use then the multiplication properties to solve the problem:

2^100 = 2^50 * 2^50

2^100 mod 3 = (2^50 mod 3 * 2^50 mod 3) mod 3

2^100 mod 3 = (1 * 1) mod 3 = 1

Even faster modular exponentiation methods exist for some specific cases (if B is a power of 2). If you want to read about them and practice modular arithmetics, check out a great tutorial from Khan Academy called What is modular arithmetic?

Modulo definition ambiguity

The word modulo comes from a Latin word modus meaning a measure. Usually, when we use the word modulo, we expect the modulo operation, like, e.g. 11 mod 3 equals 2 - so it's simply finding the remainder. In a strict definition, the modulo means:

With respect to specified modulus


A is the same as B modulo C, except for differences accounted for or explained by C

Which is the definition we wrote about in congruence modulo paragraph.

However, modulo is not only used in a math context. Sometimes you can hear it in everyday conversations - then it probably means ignoring, not accounting for something, with due allowance for something, e.g.:

The design was best so far, modulo that parts that still need some modification.

Percent - a symbol of a modulo operation

Modulo operation is often used in programming languages. The sign of % - percent - is widely used for those operations. If you're curious about the origins of the % sign, we strongly encourage you to read a short paragraph about history of a percent sign.

You need to be careful, as there's some ambiguity in the modulo definition when negative values are taken into account. There are two possible choices for the remainder - one negative and the other positive - and the result depends on the implementation in the chosen programming language. Thus, to avoid confusion, we've decided to exclude the possibility of the negative divisor in our modulo calculator.

Modulo applications

Maybe we don't see them at first sight, but there are many applications of modulo - from everyday life to math and science problems!

  1. The most obvious and well-known example is a so-called clock arithmetic 🕞. It may be adding the hours, like in the explanation of modulo above, or minutes, or seconds as well! Nobody will say that, e.g. you have 40 minutes and 90 seconds, right? The only option is to perform a modulo operation and find the quotient and remainder 60 * 1 + 30 = 90. 41 minutes and 30 seconds sounds much better.

  2. Modulo operations are used for calculation of checksums in serial numbers. Check digits are used mostly in long numbers, and they are the digits computed by an algorithm. They can inform you about errors arising, e.g. from mistyping. You can find the application of modulo, e.g. in:

  • GTIN, UPC, EAN check digits which confirm the integrity of a barcode. The formula of check digit use modulo 10.
  • ISBN and ISSN numbers, which are unique periodic and book identifiers, have modulo 11 or modulo 10, and average weighting applied in check digit formula.
  • IBAN - International Bank Accounts Numbers - make use of modulo 97 to check whether a client didn't mistype the number.
  • NPI - the US National Provider Identifier use the modulo 10 operation to calculate the tenth digit.

As the check digits are used to capture human transcription errors, they are often used for long serial numbers. Other examples of check digits algorithms using modulo operations:

  • national identification number (e.g. in Iceland, Turkey, Poland)
  • fiscal identification number (Spain)
  • vehicle identification number (US)
  • and many, many more.
  1. It is applied in many scientific areas, like computer algebra, cryptography, computer science, or simple school math - like in an Euclidean algorithm for greatest common factor calculation.

  2. Modulo is useful whenever you need to split something. A real-life example may be sharing a pizza with your friends or family.

Assuming that there are 10 slices in a big party pizza and you are a group of three. How many slices are left when you share the pizza equally?

That's exactly the case when you can use modulo! 10 mod 3 = 1. In other words, 10 divided by 3 equals 3, but it remains 1 slice left 🍕. That was not the most difficult example, but if the numbers are greater, modulo may be pretty useful.

By the way, have you seen our collection of pizza calculators? Amazing pizza party calculator, which can help to estimate how much pizza you need to order, but also the tools helping to compare pizza sizes - if you ever wondered if it's better to buy two medium pizzas or just one large, the pizza comparison calc is a safe bet. We've also prepared calculators for those who'd like to bake the perfect pizza for themselves!

Oh no. We're getting hungry. Let's leave this yummy distractor and come back to the earth. If you're interested in finding more about funny applications of modular arithmetics, check out this blog post.

Bogna Haponiuk and Hanna Pamuła - PhD candidate.

Get the widget!

Modulo Calculator can be embedded on your website to enrich the content you wrote and make it easier for your visitors to understand your message.

It is free, awesome and will keep people coming back!

Modulo Calculator