About the Modulo Calculator
The modulo operation gives the remainder when one number is divided by another. 47 mod 6 is 5, because 6 goes into 47 seven times (42) with 5 left over. It is the arithmetic of clocks, where 15 o'clock is 3 o'clock, of calendars, repeating patterns, check digits and cryptography. This modulo calculator finds a mod n for whole numbers of any size and for decimals, shows the quotient and the working, and treats negative numbers the way mathematicians do, giving a result between 0 and n minus 1. A second mode raises a number to a power and takes the modulo, using fast modular exponentiation that copes with very large powers.
Updated October 2026
How to use the Modulo Calculator
- 1Choose a mod n, or a to the power b mod n.
- 2Enter a and n, and b for a power.
- 3Read the remainder and the quotient.
- 4Check the working line, such as 47 = 7 × 6 + 5.
- 5Compare the maths remainder with the % operator result.
Everyday uses
- Clock times: 15:00 plus 10 hours is (15 + 10) mod 24 = 1.
- Days of the week: 100 days from Monday is 100 mod 7 = 2 days on, a Wednesday.
- Even and odd: n mod 2 is 0 or 1.
- Check digits: ISBN and credit card numbers use mod 10 or 11.
- Cycling through a list or screen with wraparound.
Worked examples
What is 2 to the power 10 mod 1,000? 2^10 = 1,024, and 1,024 mod 1,000 = 24. The power mode gets this and does the same for powers with hundreds of digits in a flash, by squaring and reducing at each step. Using the same trick, 7^222 mod 1,000 can be found without ever writing 7^222, which has 188 digits.
Programming notes
JavaScript, C, Java and many other languages have a remainder operator %, whose sign follows the dividend, while Python and Ruby give a result with the sign of the divisor. If you need the always-positive mathematical modulo in JavaScript, use ((a % n) + n) % n. This calculator shows both so you can test your code.
Related tools
The Long Division Calculator shows the working for quotients and remainders, the GCF and LCM Calculator finds shared factors, the Factor Calculator lists divisors and the Big Number Calculator handles large integer arithmetic.
Features
- Remainder and quotient
- Works with negative numbers and decimals
- Large integers handled exactly
- Modular exponentiation a^b mod n
- Even or odd shown
- Compares with the % operator
Frequently asked questions
What does mod mean?
a mod n is the remainder after dividing a by n. 17 mod 5 is 2, since 17 = 3 × 5 + 2. If a is a multiple of n, the remainder is 0.
How do I calculate a mod n by hand?
Divide a by n, take the whole-number part of the answer, multiply it back by n and subtract from a. For 47 ÷ 6 the whole part is 7, 7 × 6 = 42 and 47 − 42 = 5.
What is −7 mod 3?
In mathematics it is 2, since −7 = −3 × 3 + 2. Many programming languages give −1 with the % operator, because they keep the sign of the first number. The calculator shows both so that you can see the difference.
What is modular exponentiation used for?
It computes large powers within a modulus without ever writing out the huge number. It is a building block of RSA encryption, Diffie-Hellman and primality tests. For example, 4^13 mod 497 is 445.
Can I use decimals?
Yes. 5.5 mod 2 is 1.5. Because of how computers store decimals, results of long decimal inputs may show tiny rounding differences, so the tool rounds to 12 significant digits.
What happens when n is zero?
Division by zero is undefined, so a mod 0 has no value. The tool shows a message instead of a result.