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: .
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
- Remainder: The calculator shows the division a = q · m + r. For negative numbers it separates the mathematical convention (remainder always ≥ 0) from the value many programming languages return.
- Power mod m: 413 mod 497 would be tedious to multiply out. With square and multiply every intermediate step is reduced mod m at once, so even exponents with 60 digits are quick – the basis of RSA.
- Modular inverse: The inverse of a mod m is the number x with a · x ≡ 1 (mod m). It exists only when a and m are coprime; the extended Euclidean algorithm finds it.
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
- Wikipedia – Modulo (Rest, Vorzeichenkonventionen)
- Wikipedia – Modular exponentiation (Square-and-multiply)
- Wikipedia – Extended Euclidean algorithm (modulares Inverses)
As of: · Editorial policy
Related tools
- GCF and LCM CalculatorGCF and LCM calculator for two or more numbers: greatest common factor, least common multiple, prime factorization, Euclidean algorithm and all common factors.
- Prime Number CalculatorPrime number calculator: list all primes up to 10 million, check whether a number is prime or find the nth prime – with twin primes, gaps and working.
- Caesar Cipher Encoder and DecoderCaesar cipher online: encode and decode text with any shift, use ROT13, or try all 25 shifts at once to solve a message when you do not know the key.
- Long division calculatorLong division and long multiplication step by step: quotient, remainder and check, optionally with decimal places – for practising and checking homework.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Easy grader for teachersEasy grader for teachers: enter the number of questions and how many were wrong to get the percentage and letter grade, plus a full grading chart to print.
- SGPA calculator (grades and credits)SGPA calculator for Indian universities: enter each course with its grade and credits to get your semester grade point average by the UGC formula, step by step.
- Dependency ratio calculatorDependency ratio calculator: young and older people per 100 people of working age – total, youth and old-age dependency ratio with formulas and examples.
- Least Common Denominator CalculatorLeast common denominator calculator for two or more fractions: the LCM of the denominators, converted fractions and their sum with every step shown.