Modulo Calculator

NUMBER THEORY
a mod n (remainder)
Quotient (floored)
Remainder, programming % (sign of a)
Divides evenly?

The remainder after division

The modulo operation gives what is left over after dividing one whole number by another. Seventeen divided by five is three with two to spare, so 17 mod 5 is 2. This calculator returns that remainder, the floored quotient, and tells you whether the division comes out even.

Modulo and the quotient

Every division satisfies a = n times q plus r, where q is the quotient and r the remainder. The calculator reports the least non-negative remainder — the clock-style answer between 0 and n minus 1 — and also the programming-style result that takes the sign of the dividend, since the two differ for negatives.

Where modulo shows up

It is the math of anything that cycles: clock times, days of the week, wrapping around an array, and checking divisibility. A number is even exactly when it mod 2 is 0, and divisible by 9 when its digit sum mod 9 is 0.

Related tools

For converting between number systems, use the base converter; for common divisors, the GCD and LCM calculator.

Worked example

17 mod 5: five goes into seventeen three times (15), leaving 2. So the remainder is 2 and the quotient is 3, since 17 = 5 times 3 + 2.

FAQ

How is a negative dividend handled?

The headline uses the least non-negative remainder, so -17 mod 5 is 3. The programming-style row shows -2 instead, matching how most languages compute the percent operator.

What if the divisor is zero?

Division by zero is undefined, so the calculator asks for a non-zero divisor.

Spotted an error or have a suggestion for this calculator? Let us know →
Scroll to Top

The calculators and tools on Formula Factory are provided for general guidance and informational purposes only. Results are estimates based on standard formulas and the values you enter — they do not constitute professional engineering, electrical, or architectural advice. Always verify calculations with a qualified professional before making decisions for any safety-critical, code-compliance, or commercial application. Formula Factory makes no representations or warranties as to the accuracy or completeness of any result, and accepts no liability for errors, omissions, or any outcomes arising from reliance on this information.