Modulo Calculator
Work out the remainder for a division using modulo. Useful for cycles, clock arithmetic, even or odd checks, and programming style math.
Enter the Details
Supports real, negative, and scientific notation numbers
a mod n = ?
mod
Result will appear here...
What this calculator does
So, you want the remainder left over after dividing one number by another. This tool gives it. Enter a value a and a value n, and it returns a mod n, the amount that is left when a is divided by n as many whole times as it will go.
Two inputs, and the remainder comes straight back. It accepts negative numbers and scientific notation, and it stops you dividing by zero.
How to use it
- Enter the number a, the value being divided.
- Enter the number n, the value you are dividing by.
- Press Calculate.
What modulo means
The modulo operation answers a simple question: after you divide a by n and take out every whole copy of n you can, what is left behind? That leftover is the remainder, and modulo is the operation that produces it. If a divides evenly by n, the remainder is zero. Otherwise you get whatever falls short of the next whole multiple. So 17 mod 5 is 2, because 5 goes into 17 three times to make 15, and 2 is left over. It is the remainder half of ordinary division, isolated on its own.
The clock analogy
The friendliest way to picture modulo is a clock. A clock runs on modulo 12: after you reach 12 you wrap back around to 1. If it is 10 o'clock and you add 5 hours, you do not land on 15, you land on 3, because the hours cycle. That wrapping is exactly what modulo does. It takes a number that may be large and folds it back into the range of remainders, telling you where you land after going round and round. Any time something repeats in a fixed cycle, hours, days of the week, positions on a wheel, modulo is the natural tool.
Negatives and decimals
This tool works with more than tidy whole numbers. It handles decimals, so you can find the remainder of a value like 5.5 divided by 2, which comes out as 1.5. It also handles negatives, and here it is worth knowing the convention it uses: when the first number is negative, the remainder carries the sign of that first number. So the remainder keeps the sign of a, the value being divided. This is the common remainder convention used by many calculators and programming languages, and it can differ from the always positive version of modulo that some textbooks prefer, so it is good to be aware of which one you are seeing.
A worked example
Take 17 mod 5. Five goes into 17 three whole times, making 15, and 17 minus 15 is 2, so the result is 2. Now try 20 mod 5: five divides 20 exactly four times with nothing left, so the remainder is 0. And for a decimal, 5.5 mod 2 gives 1.5, since 2 goes in twice to make 4 and 1.5 remains.
Where modulo shows up
Modulo is quietly everywhere. It tells you whether a number is even or odd, since a number is even exactly when it leaves a remainder of zero on division by 2. It cycles through repeating patterns, which is how calendars work out days of the week and how computers wrap values around. It is the backbone of modular arithmetic, the branch of number theory behind everything from check digits to cryptography. If you also want the whole-number part of the division alongside the remainder, the quotient and remainder calculator gives you both together.
Questions people ask
What is a mod n?
The remainder after dividing a by n as many whole times as possible. For 17 mod 5 the answer is 2.
What if the remainder is zero?
That means n divides a exactly, with nothing left over. For example, 20 mod 5 is 0.
How does it handle negative numbers?
The remainder takes the sign of the first number, a. This is the common convention, though some textbooks use an always positive version.
Can I use decimals?
Yes. It finds the remainder for decimal values too, so 5.5 mod 2 gives 1.5.
How is this different from quotient and remainder?
Modulo gives only the remainder. The quotient and remainder calculator gives both the whole-number quotient and the remainder.
References
On the modulo operation. The result of a mod n is the remainder after dividing a by n, the basis of modular arithmetic.
- Eric W. Weisstein, "Mod," from MathWorld, a Wolfram resource, on the mod function and its link to integer division.
- Eric W. Weisstein, "Congruence," from MathWorld, a Wolfram resource, on modular arithmetic, residues, and remainders.
Okan Atalay is a results driven senior operations manager and a graduate of Industrial Engineering from Bilkent University. With over 22 years of experience in textile manufacturing and integrated operations, he has led large scale business process improvements and strategic planning initiatives. Currently, he serves as a top mathematics expert for a global ed tech platform, where he applies his analytical expertise to solve complex mathematical problems. At Eon Tools, he reviews converter and maths tools.
Other Tools
- Absolute Value Calculator
- Average Calculator
- Cube And Cube Root Calculator
- Cube Root Calculator
- Distributive Property Calculator
- Divide Into Two Parts
- Divisibility Test Calculator
- Factor Calculator
- Factorial Calculator
- Find Minimum And Maximum
- First N Digits Of E
- Full Screen Calculator
- Greatest Common Factor Calculator
- Integer Calculator
- Is It A Prime Number
- Least Common Multiple Calculator
- List Of Prime Numbers
- Long Division Calculator
- Long Multiplication Calculator
- Maths Calculator
- Multiplication Calculator
- Number Of Digits
- Prime Factor Calculator
- Prime Factorization Calculator
- Prime Number Generator
- Quotient And Remainder Calculator
- Radical Calculator
- Root Calculator
- Root Mean Square Calculator
- Rounding Numbers Calculator
- Scientific Notation Calculator
- Significant Figures Calculator
- Simplifying Radicals Calculator
- Sort Numbers
- Square Root Calculator
- Standard Form Calculator
- Summation (Sum) Calculator
- Weighted Average Calculator