Modulo Calculator
Find the remainder after division — with quotient, Euclidean and floored variants, and clock-arithmetic context for cyclic math.
a mod n
2
Breakdown
- Integer quotient
- 3
- Floored (non-negative) remainder
- 2
- Divisible?
- no
- Next multiple of n
- 20
- Steps to next multiple
- 3
Last updated:
FAQ
What is the modulo operation?
a mod n is the amount left over after dividing a by n as many whole times as possible: 17 mod 5 = 2, because 5 fits into 17 three times (15) with 2 left over. Modulo powers clock arithmetic (23:00 + 5 hours is 4:00, i.e. (23+5) mod 24), hashing, and divisibility tests.
Why do negative numbers have two answers?
Languages disagree. Truncated division (C, Java, JavaScript %) gives −7 mod 3 = −1 — the remainder takes the dividend's sign. Floored or Euclidean division (Python, mathematics) gives 2, always non-negative. Both are shown so you can match whichever convention your context uses.
How is modulo used in real life?
Deciding if a number is even (n mod 2 = 0), rotating schedules (day-of-week math is mod 7), checking divisibility, wrapping array indices, converting units (total inches mod 12 = remaining inches), and cryptography — RSA is built almost entirely on modular exponentiation.
Related Calculators
Percentage Calculator
→Calculate percentages three ways: what is X% of Y, X is what percent of Y, and Y increased or decreased by X%.
Percentage Change Calculator
→Calculate the percentage increase or decrease between two values, with the absolute difference and direction.
Percentage Difference Calculator
→Find the percentage difference between two values relative to their average — the symmetric comparison used in science and engineering.
Discount Calculator
→Calculate the sale price after a discount, how much you save, and the final price with sales tax included.