Quotient and Remainder Calculator
Divide one number by another and get the whole-number quotient and the remainder, the answer as “q R r”, a mixed number, a fraction and a repeating decimal, with long-division steps and the truncated, floored and Euclidean conventions for negative numbers.
How it works
dividend = divisor × quotient + remainder · toward zero: q = trunc(a ÷ b) · floor: q = ⌊a ÷ b⌋ · Euclidean: 0 ≤ r < |b| · remainder r = a − b × q
Integer division splits the dividend into a whole number of divisors (the quotient) and whatever is left over (the remainder), so that dividend = divisor × quotient + remainder and the remainder is always smaller in size than the divisor. For positive numbers there is only one answer, and the steps show it as long division with your numbers: bring down a digit, see how many times the divisor fits, multiply, subtract and repeat. For negative numbers there are three conventions. “Toward zero” drops the fractional part of the quotient, so the remainder has the sign of the dividend (C, Java, JavaScript). “Floor” rounds the quotient down, so the remainder has the sign of the divisor (Python, Excel MOD). “Euclidean” always keeps the remainder between 0 and the divisor’s size, as in number theory. The table shows all three side by side. You also get the answer as a mixed number, a simplified fraction and an exact decimal, with repeating digits marked in brackets. Under More options you can keep decimal inputs instead of rounding them.
Worked example
47 ÷ 6: 6 goes into 47 seven times (6 × 7 = 42), and 47 − 42 = 5 is left, so the quotient is 7 and the remainder 5, written 7 R 5. As a mixed number that is 7 5/6, as a fraction 47/6, and as a decimal 7.8(3) — the 3 repeats. Check: 6 × 7 + 5 = 47. For −47 ÷ 6 the toward-zero answer is −7 R −5, the floor and Euclidean answers are −8 R 1, and all three satisfy 6 × q + r = −47.
Sources: Euclidean division — Wikipedia · Modulo operation — Wikipedia
Frequently asked questions
How does this differ from a modulo calculator?
The remainder here is the modulo (mod) result. This calculator also gives the quotient, the mixed number, the fraction and the long-division steps, and it shows all three remainder conventions for negative numbers.
What happens with negative numbers?
It depends on the convention. Toward zero (C, Java, JavaScript): −47 ÷ 6 = −7 R −5. Floor (Python, Excel): −8 R 1. Euclidean, where the remainder is never negative: also −8 R 1. For 47 ÷ −6 the floor answer is −8 R −5 while the Euclidean answer is −7 R 5. Pick the one your class or programming language uses.
Can the remainder ever be larger than the divisor?
No. The remainder is always smaller in size than the divisor. If it were as large, the divisor would fit in at least one more time and the quotient would go up by one.
How do I write the remainder as a fraction?
Put the remainder over the divisor and add it to the quotient: 47 ÷ 6 = 7 R 5 = 7 5/6. The calculator shows this mixed number and the simplified improper fraction, 47/6.
Can I divide decimals?
Yes. By default decimals are rounded to whole numbers, as in classic remainder problems. Switch on “Allow decimal numbers” under More options and 7.5 ÷ 2 gives quotient 3 and remainder 1.5, because 2 × 3 + 1.5 = 7.5.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.