Modulus Calculator
Find the remainder when one number is divided by another.
Tip: Press Enter in either input to calculate quickly.
What does modulus mean?
The modulus operation (often written as a mod b) gives you the
remainder after dividing a by b. If you divide 17 by 5, you get 3
with remainder 2, so:
17 mod 5 = 2
This operation is one of the most useful ideas in math and programming because it helps you work with cycles, grouping, repeat patterns, and divisibility checks.
How to use this modulus calculator
- Enter the first number (the dividend).
- Enter the second number (the divisor).
- Click Calculate.
- Read the remainder and division check shown in the result box.
If you enable Euclidean modulus, your result is always non-negative, which is often preferred in mathematics and many algorithms.
Examples of modulus calculation
Basic examples
10 mod 3 = 124 mod 6 = 0(divides evenly)99 mod 10 = 9123 mod 7 = 4
Negative number examples
Negative values can be tricky because some programming languages return a negative remainder.
With Euclidean mode enabled, this page always returns a value from 0 to |b|-1.
- JavaScript remainder:
-13 % 5 = -3 - Euclidean modulus:
-13 mod 5 = 2
Why modulus is so useful
1) Checking divisibility
If a mod b = 0, then a is divisible by b. This is used
constantly in number theory and coding interviews.
2) Working with cycles
Modulus is perfect for anything circular: clocks, weekdays, rotating arrays, turn systems in games, and repeating schedules. For example, hours on a 12-hour clock are naturally modulo 12.
3) Computer science and software engineering
- Wrapping index values inside array bounds
- Hash table bucket selection
- Load balancing and sharding rules
- Pattern generation and procedural logic
- Cryptography foundations (e.g., modular arithmetic)
Step-by-step manual method
Suppose you want to calculate 137 mod 12:
- Divide 137 by 12.
- 12 goes into 137 eleven times (11 × 12 = 132).
- Subtract: 137 − 132 = 5.
- So, 137 mod 12 = 5.
Common mistakes to avoid
- Dividing by zero: modulus with divisor 0 is undefined.
- Confusing quotient and remainder: modulus returns the remainder, not the division result.
- Ignoring sign rules: negative inputs can produce language-specific results.
- Using decimal values accidentally: modulus is usually discussed for integers.
Quick FAQ
Is modulus the same as percent?
No. The symbol % in many programming languages means remainder, not percentage.
Context matters.
What does it mean when the modulus is zero?
It means exact divisibility. Example: 28 mod 7 = 0 means 7 divides 28 with no remainder.
Should I use Euclidean modulus?
For math, indexing, and cycle logic, Euclidean modulus is often easier because it always stays non-negative.
Final thought
If you master modulus, you gain a practical tool for arithmetic reasoning and cleaner code. Use the calculator above for quick checks, then practice doing a few by hand to build intuition.