Modulo Calculator

The modulo calculator gives the remainder of a division: 17 mod 5 = 2 because 17 = 3 · 5 + 2. It also works out large powers mod m (square and multiply) and the modular inverse – exactly, even for numbers with up to 60 digits, and with the steps shown.

Source: Wikipedia – Modulo (Rest, Vorzeichenkonventionen). Updated: .

Whole number, negative allowed, up to 60 digits
Whole number other than 0
My ToolboxYour inputs are saved in this browser only.

Result

Result
17 mod 5 = 2
Working
  • Division: 17 = 3 · 5 + 2

How it is calculated

“a mod m” is the remainder left when a is divided by m. Since 17 = 3 · 5 + 2, 17 mod 5 = 2. Modular arithmetic is clock arithmetic: after 12 hours the count starts again, so 15:00 is 3 o’clock because 15 mod 12 = 3.

Three tasks in one calculator

What is it used for?

Weekdays (mod 7), check digits of IBANs and ISBNs, cryptography and hash tables. For the greatest common divisor use the GCF and LCM calculator; the classic shift cipher (remainder mod 26) is shown by the Caesar cipher tool.

Frequently asked questions

What does modulo mean?

a mod m is the remainder of the whole-number division of a by m. 17 mod 5 = 2 and 20 mod 5 = 0. Two numbers are congruent modulo m when they leave the same remainder.

How do I work out modulo by hand?

Subtract multiples of m until a value between 0 and m−1 is left. For 100 mod 7: 100 − 98 = 2, because 98 = 14 · 7.

What is 5 mod 0?

It is undefined, because you cannot divide by 0. The calculator reports an error.

How do I calculate a large power mod m?

By repeated squaring: square the base step by step (each time mod m) and multiply in the intermediate results where the binary exponent has a 1. The table shows every step.

When does a modular inverse exist?

Exactly when the greatest common divisor of a and m is 1. Modulo 11 every number from 1 to 10 has an inverse; modulo 9 the number 6 has none.

Sources and legal basis

As of: · Editorial policy

Related tools