Modulo Calculator (Remainder and Mod)
Enter a dividend and a divisor to get the remainder, the floored modulo, and the integer quotient. Negative values are handled correctly, so you can see exactly how the two conventions differ.
How to compute a modulo
- Enter the dividend (the number being divided).
- Enter the divisor (the number you divide by).
- Read the remainder, the floored modulo, and the quotient.
Examples
17 mod 5
dividend 17, divisor 5
remainder 2, modulo 2, quotient 3
Negative dividend
dividend -7, divisor 3
remainder -1, modulo 2, quotient -2
Frequently asked questions
What is the difference between remainder and modulo?
The remainder follows the dividend's sign, the way the % operator works in most programming languages, so -7 % 3 is -1. The floored modulo follows the divisor's sign, so the same numbers give 2. They match whenever both numbers share a sign.
How does this calculator handle negative numbers?
The remainder is computed as dividend % divisor (truncated division), and the modulo as ((dividend % divisor) + divisor) % divisor, which stays non-negative for a positive divisor.
How is the quotient defined?
The quotient uses truncated division, Math.trunc(dividend / divisor), which rounds toward zero. So -7 divided by 3 gives a quotient of -2.
Why can the divisor not be zero?
Division and the modulo operation are undefined when the divisor is zero, so the calculator rejects it.
Do the dividend and divisor have to be whole numbers?
No. The calculator accepts decimals, and the JavaScript % operator extends naturally to them, for example 5.5 % 2 is 1.5.
Related tools
GCD Calculator
Find the greatest common divisor of two or more integers with the Euclidean algorithm. Handles negatives and zero. Free, fast, and private.
Rounding Calculator
Round a number to decimal places or the nearest 5, 10, or 0.25. Choose half up, bankers, ceiling, floor, or truncation. Handles negatives. Free.
Exponent Calculator
Raise any base to any power online. Handles negative and fractional exponents, shows the result with scientific notation, and updates instantly.
Annulus Area Calculator
Calculate the area of an annulus, the ring between two concentric circles, from its outer and inner radius. Returns both circumferences and width too. Free.
Area Calculator
Find the area of a circle, square, rectangle, triangle, trapezoid, parallelogram, ellipse, sector or rhombus. Free and runs in your browser.
Arithmetic Sequence Calculator
Find the nth term, the sum of n terms and the full term list for any arithmetic or geometric sequence. Enter the first term, step or ratio, and n.