Modulo Calculator

Find the remainder and quotient of a division, plus the true non-negative mathematical modulo.

Enter a dividend and a divisor to compute the remainder. For example: 17 mod 5.

What is the Modulo Operation?

The modulo operation finds the remainder after division of one number (the dividend) by another (the divisor). It is often written as a mod n. For example, 17 mod 5 equals 2, because 17 divided by 5 is 3 with a remainder of 2.

Formulas

  • Quotient: q = floor(a / n)
  • Remainder: r = a - n × q
  • True modulo (non-negative): ((a mod n) + n) mod n

Tip: JavaScript's % operator returns a remainder that shares the sign of the dividend, so it can be negative. The true mathematical modulo is always non-negative when the divisor is positive.

Note: This calculator provides mathematical calculations for the modulo operation based on the formulas described. While we strive for accuracy, please verify important calculations independently. This tool is for educational and informational purposes and should not be the sole basis for financial, academic, or professional decisions.