Modulo Calculator
The modulo operation, written a mod b, returns the remainder left after dividing a (the dividend) by b (the divisor). This calculator gives the remainder the moment you type and walks you through the division step by step, so it fits programming, math homework, and anyone learning how remainders work.
Where the Modulo Operation Is Used
Even / Odd Checks
Clock Arithmetic
Hashing & Cryptography
How to Calculate a mod b
Enter the Dividend (a)
Type the number you want to divide. Whole numbers and decimals are both accepted.
Enter the Divisor (b)
Type the number to divide by. The remainder of a ÷ b is what the calculator returns.
Read a mod b
The remainder appears on the formula line instantly and recalculates as you change either value.
Check the Explanation
The explanation panel shows a ÷ b, the integer quotient, the verification (quotient × b), and the remainder subtraction.
Features
Instant Remainder
The remainder updates live as you type the dividend or divisor — no button to press.
Step-by-Step Explanation
See a ÷ b, the integer quotient, the verification quotient × b, and the remainder — not just the final answer.
Decimals & Negatives
Handles fractional and negative values, so 17.5 mod 3 = 2.5 and −17 mod 5 = −2 both work.
Divide-by-Zero Guard
A divisor of 0 is rejected with a clear message, since a mod 0 is undefined.
Worked Examples
| Expression | Result | Why |
|---|---|---|
| 17 mod 5 | 2 | 17 = 5 × 3 + 2 |
| 10 mod 3 | 1 | 10 = 3 × 3 + 1 |
| 15 mod 5 | 0 | 15 divides evenly |
| 7 mod 2 | 1 | 7 is odd |
| −17 mod 5 | −2 | Remainder takes the dividend's sign |
| 17.5 mod 3 | 2.5 | Decimals are supported |
Frequently Asked Questions
What is the modulo operation?
Modulo (mod) gives the remainder after division. For example, 17 mod 5 = 2 because 17 = 5 × 3 + 2. It answers "what is left over?" once the divisor has gone in as many whole times as possible.
What is the difference between modulo and remainder?
For positive numbers they are the same value. The terms diverge only with negative operands, where different conventions can give different signs. This tool computes the remainder that takes the sign of the dividend.
How does modulo work with negative numbers?
This calculator follows the convention where the remainder takes the sign of the dividend, so −17 mod 5 = −2. Some languages such as Python floor instead and return 3, so always check how your specific language defines the operation.
Can I use decimals in the modulo calculator?
Yes. Both the dividend and divisor accept fractional values, so 17.5 mod 3 = 2.5. The remainder is the amount left after the divisor fits a whole number of times.
Can the divisor be zero?
No. Division by zero is undefined, so a mod 0 has no valid result. The calculator rejects a divisor of 0 with a clear message — always use a non-zero divisor.
No comments yet. Be the first to comment!