Modulo Calculator
Use this free calculator to find the remainder when one number is divided by another number.
Tip: press Enter in either input to calculate quickly.
What is modulo?
Modulo is the operation that gives you the remainder after division. If you divide a by b, the modulo result is what is left over after taking out full groups of b.
For example, 29 mod 5 = 4 because 5 goes into 29 five times (5 × 5 = 25), and 4 remains.
Core formula
The modulo relationship is usually written as:
a = b × q + r
- a = dividend
- b = divisor
- q = quotient
- r = remainder (the modulo result)
How to use this calculator modulo
- Enter a value for the dividend (a).
- Enter a value for the divisor (b).
- Select your preferred mode (Euclidean or JavaScript style remainder).
- Click Calculate a mod b.
The tool returns the modulo value and shows a check equation so you can verify the result instantly.
Examples
| Expression | Result | Why |
|---|---|---|
| 29 mod 5 | 4 | 29 = 5 × 5 + 4 |
| 100 mod 8 | 4 | 100 = 8 × 12 + 4 |
| 42 mod 7 | 0 | 42 is divisible by 7 with no remainder |
| -13 mod 5 (Euclidean) | 2 | Remainder is kept non-negative |
Why negative numbers can look confusing
Different systems define modulo slightly differently for negative values:
- Euclidean modulo keeps the result between 0 and |b| − 1.
- JavaScript remainder (%) follows truncation rules, so the sign can differ.
That is why this calculator gives you a mode switch. You can pick the convention that matches your class, programming language, or project.
Where modulo is used in real life
1) Programming and computer science
Modulo is used for indexing circular arrays, alternating logic, hashing, sharding, and pattern repetition. If you need a value to “wrap around,” modulo is the standard tool.
2) Time and scheduling
Clocks are modular systems. After 12 comes 1, after 23 comes 0 in a 24-hour format. Calculating day-of-week cycles also relies on modulo arithmetic.
3) Cryptography
Modern encryption systems use modular arithmetic heavily. Concepts like modular exponentiation and modular inverses are foundational in secure communications.
Common mistakes to avoid
- Using zero as divisor: modulo by 0 is undefined.
- Mixing modulo definitions: negative number answers may differ by convention.
- Confusing % with percentage: modulo is not the same as percent.
- Ignoring integer context: modulo is most common with integers, even if tools accept decimals.
Quick FAQ
Is modulo the same as remainder?
In many contexts yes, but exact behavior with negatives depends on the chosen definition.
Can I use decimal numbers?
This calculator accepts numeric inputs, but modulo is typically taught and used with integers.
What if the result is 0?
That means the dividend is perfectly divisible by the divisor.
Final thought
If you work with cycles, grouping, parity checks, periodic events, or algorithm design, modulo is one of the most useful operations you can master. Save this page and use the calculator whenever you need quick, accurate modulo results.