Modulo Calculator
Enter a dividend and a divisor to get the remainder of a mod n, plus the whole-number quotient — using the floored definition that handles negative numbers consistently.
Remainder and quotient at once
Enter the dividend and divisor and the calculator returns the modulo (the remainder a − n × floor(a ÷ n)) together with the integer quotient.
Divisor can't be zero
Modulo by zero is undefined, just like ordinary division. The dividend may be zero, positive, or negative.
What is the modulo operation?
The remainder after division
This modulo calculator finds what is left over after dividing one number by another. The modulo operation, written a mod n, returns the remainder when the dividend a is divided by the divisor n. After you take out as many whole multiples of n as fit into a, the modulo is whatever remains. It is one of the most-used operations in computing — wrapping a clock back to zero after 12 hours, cycling an index through a list, alternating rows in a table, or testing whether a number is even or divisible by another. This calculator returns both the remainder and the integer quotient (how many whole times the divisor fits).
Enter a dividend and a divisor to get the remainder (a mod n) and the integer quotient instantly — negative dividends included.
The modulo uses the floored definition: divide, round the quotient down to a whole number, then subtract that many divisors from the dividend.
a mod n = a − n × floor(a ÷ n)Take a dividend of 17 and a divisor of 5. First find the quotient: floor(17 ÷ 5) = floor(3.4) = 3. Then subtract: 17 − 5 × 3 = 17 − 15 = 2. So 17 mod 5 = 2, and 5 fits into 17 three whole times with 2 left over. Using floor (rounding toward negative infinity rather than toward zero) is what makes the remainder behave consistently when the dividend is negative — see the limitations below.
The operation is exact, but the sign convention is the thing to watch.
Sign conventions and divide-by-zero
This calculator uses the floored definition, so the remainder always takes the sign of the divisor and lands in the range from 0 up to n. For example, -17 mod 5 = 3, because floor(-17 ÷ 5) = -4 and -17 − 5 × (-4) = 3. Many programming languages (C, Java, JavaScript's % operator) instead use truncated division, which would give -2 for the same inputs — so check which convention your tool follows before relying on a result. The divisor must not be zero, since modulo by zero is undefined; the dividend, by contrast, may be zero or negative.