Modulo Calculator

Divide one number by another to get the remainder and the quotient. Shows both the programming remainder and the always-positive Euclidean modulo.

Remainder (a mod b)
Quotient (floor a/b)
Euclidean mod (always ≥ 0)

The remainder uses the programming convention, where the sign follows the dividend (the same as the % operator in JavaScript, C and Java). The Euclidean modulo is always zero or positive, which is the usual mathematical definition.

Frequently asked questions

What is the modulo operation?

Modulo gives the remainder after dividing one number by another. For example 17 mod 5 is 2, because 5 goes into 17 three times with 2 left over. It is widely used in programming for wrapping, cycles and hashing.

Why are there two results for negative numbers?

Programming languages like JavaScript make the remainder take the sign of the dividend, so -17 mod 5 is -3. Mathematicians usually prefer a result that is always zero or positive, the Euclidean modulo, which would give 2. The tool shows both.

What does the quotient show?

It is how many whole times the divisor goes into the dividend, rounded down. Together the quotient and remainder reconstruct the original number: quotient times divisor plus remainder.