Remainder Calculator

This remainder calculator gives the quotient and the remainder for any division, and shows what happens when either number is negative. You get the truncated remainder that C, Java and JavaScript return, the floored modulo Python and Ruby return, and the Euclidean remainder.

Remainder calculatorLive — updates as you type

How to use the remainder calculator

  1. Type the dividend — the number being divided — into the first box.
  2. Type the divisor into the second box. Either value can be negative.
  3. Read the remainder at the top, with the full statement underneath in the form 17 ÷ 5 = 3 remainder 2.
  4. The panel below lists the quotient, the floored modulo, the Euclidean remainder and the exact decimal quotient, so you can see all three conventions side by side.

Results update as you type. If you want the decimal answer worked out in full instead of the leftover, the division calculator takes the same division through long division and into the decimal places.

What a remainder actually is

a = b × q + r, with 0 ≤ r < |b|
a is the dividend, b the divisor, q the quotient and r the remainder. Given any a and any non-zero b, exactly one pair of q and r fits.

That statement is called the division algorithm, and the uniqueness is the point. For 17 and 5 the only whole-number pair that works is q = 3 and r = 2, because 5 × 3 + 2 = 17 and 2 is smaller than 5.

The remainder is what is left after you take out as many whole divisors as will fit. It is always smaller than the divisor. If you ever produce a remainder as big as the divisor, another whole one fits and the quotient was too low.

Example: 17 ÷ 5

17 ÷ 5 = 3.4 Whole part of the quotient: 3 5 × 3 = 15 17 − 15 = 2

So 17 ÷ 5 = 3 remainder 2, and the check 5 × 3 + 2 = 17 confirms it.

Example: 250 ÷ 7

250 ÷ 7 = 35.714… Whole part: 35 7 × 35 = 245 250 − 245 = 5

250 ÷ 7 = 35 remainder 5. Notice 5 < 7, as it must be.

There is also a quick way to get a remainder from any plain calculator. Divide, throw away everything after the point, multiply back by the divisor and subtract: 100 ÷ 12 = 8.333…, so 12 × 8 = 96 and 100 − 96 = 4.

Remainder and modulo: the same until something goes negative

For positive numbers, “remainder” and “modulo” mean the same thing and every calculator, language and textbook agrees. Introduce a negative and they split into three different answers, all of them defensible.

  • Truncated remainder. Cut the quotient toward zero, then subtract. The result takes the sign of the dividend. This is what C, C++, Java, C#, Go, Rust and JavaScript’s % return.
  • Floored modulo. Round the quotient down toward negative infinity. The result takes the sign of the divisor. This is Python’s %, Ruby’s %, and what mathematicians usually mean by “mod n”.
  • Euclidean remainder. Always non-negative, whatever the signs. This is the one that satisfies 0 ≤ r < |b| from the division algorithm above.
DivisionTruncated (C, Java, JS)Floored (Python, Ruby)Euclidean
17 ÷ 5222
−17 ÷ 5−233
17 ÷ −52−32
−17 ÷ −5−2−23
−7 ÷ 3−122
7 ÷ −31−21

Take the second row. JavaScript evaluates -17 % 5 as −2, because it truncates −3.4 to −3 and 5 × −3 = −15 leaves −2. Python evaluates -17 % 5 as 3, because it floors −3.4 to −4 and 5 × −4 = −20 leaves 3. Both satisfy a = b × q + r. They just chose different qs.

Watch outNeither answer is a bug. If you are wrapping a value around a range — hours on a clock, indexes in a list, degrees on a compass — you almost always want the floored or Euclidean version, because a negative remainder will index backwards off the end. In C-family languages, write ((a % b) + b) % b to force a non-negative result.

What remainders are used for

Remainders are far more than the leftover bit of a school division. Most of the time you want the remainder and do not care about the quotient at all.

  • Odd or even. n mod 2 is 0 for even numbers and 1 for odd. The same idea colors alternate rows of a table or splits people into two teams.
  • Every nth item. i mod 3 = 0 picks out every third item in a list, which is how repeating patterns and page breaks get built.
  • Leap years. A year is a leap year if it is divisible by 4, unless it is divisible by 100, unless it is also divisible by 400. 2024 mod 4 = 0, so it is a leap year. 1900 mod 100 = 0 and 1900 mod 400 = 300, so it is not. 2000 mod 400 = 0, so it is.
  • Clocks and wrap-around. Seven hours after 21:00 is (21 + 7) mod 24 = 4, so 04:00. One hundred days after a Tuesday lands on 100 mod 7 = 2 days later, a Thursday.
  • Splitting into groups. 100 items packed 12 to a box is 8 full boxes with a remainder of 4, so you need 9 boxes and the last one is part-filled.
  • Check digits. Bank codes, barcodes and ISBNs finish with a digit chosen so that a weighted sum of all the digits leaves remainder 0 when divided by 10, 11 or 97. Mistype one digit and that remainder is no longer 0, so the number is rejected.

Hashing works the same way: mod table_size picks a slot. For very large values, exact remainders need exact arithmetic, which the big number calculator gives you.

Divisibility rules: predicting a zero remainder

You can often tell that the remainder will be 0 without dividing at all. These rules are exact, not rules of thumb.

DivisorTestExample
2The last digit is even3,914 ends in 4, so yes
3The digits add to a multiple of 32,571 → 2+5+7+1 = 15, so yes
4The last two digits form a multiple of 47,316 → 16, so yes
5The last digit is 0 or 54,285 ends in 5, so yes
6It passes both the 2 test and the 3 test4,152 is even and 4+1+5+2 = 12, so yes
9The digits add to a multiple of 95,823 → 5+8+2+3 = 18, so yes
10The last digit is 06,470 ends in 0, so yes
11Alternately subtract and add the digits from the right; the result is a multiple of 11 (0 counts)90,728 → 8 − 2 + 7 − 0 + 9 = 22, so yes

The 3 and 9 tests work because 10 leaves remainder 1 when divided by 3 or by 9, so every power of ten does too, and a number ends up with the same remainder as the sum of its digits. The 11 test works because 10 leaves remainder −1 when divided by 11, so the place values alternate in sign.

The digit-sum tests give you more than a yes or no. The remainder of the digit sum is the remainder of the whole number: 2,573 has digit sum 17, and 17 mod 3 = 2, so 2,573 mod 3 = 2 as well.

Common mistakes

  • Reading the decimal part as the remainder. 17 ÷ 5 = 3.4 does not mean remainder 4. The 0.4 is a fraction of the divisor, so the remainder is 0.4 × 5 = 2.
  • Assuming every language agrees on negatives. -17 % 5 is −2 in JavaScript and 3 in Python. Porting code between the two without checking will move an index or a date by a whole cycle.
  • Producing a remainder as big as the divisor. If you get remainder 5 when dividing by 5, one more divisor fits. The quotient was one too small.
  • Rounding the quotient instead of truncating it. The quotient is the whole part, rounded toward zero, not to the nearest whole number.
  • Dropping the remainder when it needs a whole extra unit. 100 people at 12 per bus needs 9 buses, not 8.
  • Taking a remainder mod 0. There is no such thing, for the same reason division by zero is undefined.
  • Forgetting the check. Multiply the divisor by the quotient and add the remainder with the multiplication calculator. If you do not get the dividend back, one of the two is wrong.

Frequently asked questions

What is the remainder of 17 divided by 5?

The remainder is 2 and the quotient is 3. Five goes into 17 three whole times, 5 × 3 = 15, and 17 − 15 = 2. Written out in full: 17 = 5 × 3 + 2. The remainder is smaller than 5, as it always must be.

What is 100 divided by 7 with a remainder?

100 ÷ 7 = 14 remainder 2. Seven fits into 100 fourteen times, 7 × 14 = 98, and 100 − 98 = 2. As a decimal the same division is 14.2857…, and the repeating part is that remainder of 2 divided by 7.

What is −17 mod 5?

It depends on the convention. Python and Ruby give 3, because they floor the quotient to −4 and 5 × −4 = −20 leaves 3. C, Java and JavaScript give −2, because they truncate the quotient to −3 and 5 × −3 = −15 leaves −2. Both are shown above.

What is the difference between remainder and modulo?

Nothing at all when both numbers are positive. When one is negative they diverge: a remainder normally takes the sign of the dividend, while a modulo takes the sign of the divisor. Mathematicians usually mean the second, and the Euclidean version, which is never negative, is a third option.

Can a remainder be negative?

Under the strict division algorithm, no — it requires 0 ≤ r < |b|. But most programming languages return a negative remainder when the dividend is negative, so in code the answer is yes. To force it non-negative in a C-family language, use ((a % b) + b) % b.

How do you find a remainder on a normal calculator?

Divide, drop everything after the decimal point, multiply that whole number back by the divisor, then subtract from the dividend. For 250 ÷ 7 you get 35.714…, so take 35, multiply 7 × 35 = 245, and 250 − 245 = 5. The remainder is 5.

Can the remainder be zero?

Yes, and it is the most useful answer of the lot. A remainder of 0 means the divisor divides the dividend exactly, which is how divisibility tests, even and odd checks and check digits all work. 144 mod 12 = 0, so 12 divides 144 evenly.

Is 2,571 divisible by 3?

Yes. Add the digits: 2 + 5 + 7 + 1 = 15, and 15 is a multiple of 3, so 2,571 is too. The division gives 857 with remainder 0. The same trick reports the remainder in general: if the digit sum leaves 2 when divided by 3, so does the original number.

Put this calculator on your own site (free)

Copy this into any page. The calculator stays up to date on its own, works on mobile, and carries a small credit link back here.

Preview it
Cite this page “Remainder Calculator”. Four Function Calculator, 6 September 2026.https://fourfunctioncalculator.com/remainder-calculator/
Shows the workingRuns entirely in your browser — nothing you type is sent anywhere.Last reviewed 6 September 2026