Remainder Calculator (Modulo)
Find the quotient and remainder of a divided by b (a mod b). Shows the truncated, floored, and Euclidean definitions, plus how negative numbers behave.
Input
Enter dividend a and divisor b to find the quotient and remainder (a mod b). It also shows the truncated, floored, and Euclidean definitions and how negative numbers behave.
The number being divided
The number to divide by (not zero)
Result
Remainder of 17 divided by 5
2
Quotient (integer part)
3
Floored quotient
3
Euclidean remainder (non-negative)
2
Verification
17 = 5 × 3 + 2
Quotient and remainder by definition
Truncated division
Quotient rounds toward zero. Remainder has the same sign as a.
Quotient 3
Remainder 2
Floored division
Quotient rounds toward negative infinity. Remainder has the same sign as b.
Quotient 3
Remainder 2
Euclidean remainder
Remainder is always non-negative and below the absolute value of the divisor.
Quotient 3
Remainder 2
When the dividend is negative, the quotient and remainder differ by definition. Choose the method that fits your use case.
In every definition, divisor times quotient plus remainder equals the dividend.
How it works
- A remainder is what is left over when dividend a is divided by divisor b and does not divide evenly (a mod b). The quotient is how many times it divides, and the remainder is the leftover.
- Truncated division rounds the quotient toward zero, and the remainder takes the same sign as a. This matches the percent operator in many programming languages.
- Floored division rounds the quotient toward negative infinity, and the remainder always takes the same sign as the divisor b.
- The Euclidean remainder is always at least zero and stays below the absolute value of the divisor. It is used as the mathematical remainder.
- When b is zero the remainder is undefined. When a is negative the quotient and remainder depend on the definition, so choose the method that fits your use case.
- In every method, divisor times quotient plus remainder equals the dividend.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Remainder Calculator (Modulo)