Modulo Calculator
Calculate a mod n for whole or decimal numbers of any size, with the quotient and remainder. Shows the math (floored) and programming (truncated) results.
- Quotient (floored)
- 3
- Remainder (truncated, like % in C or JavaScript)
- 2
- Check
- 3 × 5 + 2 = 17
Modulo: the remainder after division
a mod n is what's left after dividing a by n as many whole times as possible: 17 mod 5 = 2, because 17 = 3 × 5 + 2. With negative numbers there are two conventions. Mathematics (and Python) use the floored result, which takes the sign of the divisor: −17 mod 5 = 3. C, Java and JavaScript's % operator truncate, giving −2. The calculator shows both, and handles whole numbers of any length exactly.
How to use it
- 1
Enter the dividend
The number being divided (a).
- 2
Enter the divisor
The modulus (n).
- 3
Read the result
a mod n, the quotient and both remainders.
Frequently asked questions
What is 10 mod 3?
1, because 10 = 3 × 3 + 1.
Why do calculators disagree on negative numbers?
Some use floored division (result has the divisor's sign) and some truncated division (result has the dividend's sign).
What is modulo used for?
Clock arithmetic, checking even and odd numbers, cycling through lists, check digits and cryptography.
Is anything stored?
No. The calculation runs in your browser.
Math calculators
- Percentage Calculator
- Percentage Change Calculator
- Fraction Calculator
- Average Calculator
- Discount Calculator
- Online Calculator
- Scientific Calculator
- Quadratic Formula Calculator
- Slope Calculator
- Distance Formula Calculator
- Square Root Calculator
- LCM and GCF Calculator
- Scientific Notation Calculator
- Long Division Calculator
- Aspect Ratio Calculator
- Percentage Increase Calculator
- Mixed Number Calculator
- Percentage Difference Calculator
- Ratio Calculator
- Area Calculator
- Circle Calculator
- Statistics Calculator
- Weighted Average Calculator
- Trigonometry Calculator
- Significant Figures Calculator
- Rounding Calculator
- Triangle Calculator
- Percentile Calculator
- Cross Product Calculator
- Factorial Calculator
- Binary Calculator
- GPA Calculator
- Decimal to Fraction Calculator
- Matrix Calculator