Skip to main content

Remainder Calculator

Blake Boege
Written by Blake Boege · Founder, Calculator Answers

A remainder calculator is an arithmetic utility that solves division problems by returning both the quotient as a whole number and the remainder. It performs integer division on a dividend and a divisor using the formula where the dividend equals the divisor multiplied by the quotient plus the remainder. The calculator can also display the result as a decimal, a mixed number, and show the step-by-step long division work. Students, programmers, and mathematicians use this tool to solve modular arithmetic and verify division solutions.

Enter two whole numbers and the calculator returns the quotient and a non-negative remainder, with the matching division statement and modulo notation.

Quick Answer

Calculate the quotient and remainder for any integer division. Enter your dividend and divisor to find the whole number result and leftover remainder.

Whole number to divide. · e.g. 17

Cannot be 0. · e.g. 5

Returns the quotient and a non-negative remainder. Dividend = divisor × quotient + remainder.

Remainder

Quotient and remainder

3 R 2

17 ÷ 5

Dividend17
Divisor5
Quotient3
Remainder2
Statement17 = 5 × 3 + 2
Modulo17 mod 5 = 2

The calculator returns a non-negative remainder (Euclidean division), so 0 ≤ remainder < |divisor|. The JavaScript % operator gives a different sign for negative dividends.

Was this helpful?

Examples

17 ÷ 5

= 3 R 2 · 17 mod 5 = 2

100 ÷ 7

= 14 R 2 · 100 mod 7 = 2

20 ÷ 4

= 5 R 0 · 20 mod 4 = 0

How it works

Formula · dividend = divisor × quotient + remainder, with 0 ≤ remainder < |divisor|

For whole numbers a and b with b nonzero, there is exactly one pair (q, r) such that a = b · q + r and 0 ≤ r < |b|. That q is the quotient and r is the remainder. This is the Euclidean form of division.

Definition · dividend = divisor · quotient + remainder

Constraint · 0 ≤ remainder < |divisor|

Always returns a non-negative remainder even for negative dividends.

By hand, the long division

The remainder of division is whatever is left when one whole number will not divide another exactly. Dividing 17 by 5: the whole point is that 5 goes in three times and something is left over.

  1. Ask how many whole 5s fit inside 17. Three, because 3 × 5 = 15 and a fourth would overshoot at 20.
  2. Subtract what fitted. 17 − 15 = 2. That is the remainder.
  3. Check it with the identity every division obeys: dividend = divisor × quotient + remainder, so 5 × 3 + 2 = 17.

That identity is the thing to hold on to. Every convention below satisfies it. What they disagree about is which quotient to pick when the numbers go negative.

Negative numbers, where the conventions disagree

This is the part worth reading carefully, because two defensible answers exist and different tools give different ones. Take −7 ÷ 3.

  • Round the quotient down to −3, and the remainder must be −7 − (−3 × 3) = 2. The remainder is never negative. This is the Euclidean form.
  • Round the quotient toward zero to −2, and the remainder must be −7 − (−2 × 3) = −1. The remainder takes the sign of the dividend. This is the truncated form, and it is what the % operator returns in C, Java, JavaScript and many others.

Both satisfy the identity: −3 × 3 + 2 = −7 and −2 × 3 + (−1) = −7. Neither is a bug. Arithmetic does not settle which quotient to round to, so a convention has to.

This calculator reports the Euclidean form as its main answer, so the remainder is always non-negative, and shows the truncated form alongside it so you can see both. If you are checking work against a programming language, the truncated row is the one to compare.

The four sign combinations

Every case, both ways, so you can find yours without rederiving it.

DivisionEuclideanTruncated
7 ÷ 3q = 2, r = 1q = 2, r = 1
−7 ÷ 3q = −3, r = 2q = −2, r = −1
7 ÷ −3q = −2, r = 1q = −2, r = 1
−7 ÷ −3q = 3, r = 2q = 2, r = −1

The two agree whenever the dividend is positive. They part company exactly when it is negative, which is why the bug only ever shows up on the edge case nobody tested.

This page or the mod calculator?

They run the same arithmetic and answer to different readers, which is why both exist.

  • This page is the long division one. Quotient and remainder, the classroom identity, checking a division done by hand. If you are helping with school arithmetic, stay here.
  • The mod calculator frames the same operation the way programming does: modulo, wrapping an index around an array length, bucketing a hash, testing divisibility. Same numbers, different vocabulary and different worked examples.

Edge cases

  • Dividing by zero. Rejected. There is no number of times zero fits into anything, so there is no quotient and no remainder to report. The calculator says so rather than returning infinity.
  • Non-integer inputs. Rejected. Quotient and remainder are defined for whole numbers; for decimals the leftover is just ordinary division.
  • A remainder of zero. Not an error, and worth noticing: it means the divisor divides the dividend exactly, which is the same as saying the dividend is a multiple of it.
  • A divisor larger than the dividend. The quotient is 0 and the remainder is the dividend itself: 3 goes into 7 twice, but 7 goes into 3 zero times with 3 left over.

Your figures stay in the page

The numbers you enter are processed by this page in your browser. They are not sent to a server, not stored after you close the tab, and not visible to anyone else. There is no account and nothing to sign up for.

Related math calculators

Frequently asked questions

When you divide one whole number by another, the remainder is what is left over after the divisor goes into the dividend as many full times as possible. For 17 ÷ 5, the divisor 5 fits 3 times into 17 (using 15), and the remaining 2 is the remainder. The full relationship is dividend = divisor × quotient + remainder.

Divide the dividend by the absolute value of the divisor and take the floor for the quotient. Multiply that quotient back by the divisor and subtract from the dividend to get the remainder. This calculator uses Euclidean division so the remainder is always non-negative and strictly less than the absolute value of the divisor.

In day-to-day math they are the same: the leftover from division. In programming, % is called the modulo operator and is well defined for both positive and negative inputs, but different languages choose different sign conventions. JavaScript's % keeps the sign of the dividend, while mathematical 'mod' (Euclidean) always returns a non-negative value. This calculator uses the Euclidean convention.

With Euclidean division the remainder is always 0 ≤ r < |divisor|. So -7 mod 3 returns quotient -3 and remainder 2, because -7 = 3 × (-3) + 2. The signed remainder you would see from JavaScript's % operator for -7 % 3 is -1, with quotient -2. Both are valid; this calculator picks the non-negative form because it lines up with how math is normally taught.

Division by 0 is undefined. The calculator flags the input and returns no answer. Make sure the divisor is a nonzero whole number.

It depends on the convention, and both answers are defensible. For -7 divided by 3, rounding the quotient down gives q = -3 and r = 2, so the remainder is never negative. Rounding the quotient toward zero gives q = -2 and r = -1, so the remainder takes the sign of the dividend. Both satisfy dividend = divisor x quotient + remainder. This calculator reports the first as its main answer and shows the second alongside it.

The Euclidean one: the remainder is always non-negative, between 0 and one less than the absolute value of the divisor. The truncated form, which is what the % operator returns in C, Java and JavaScript, is shown next to it so you can compare. If you are checking work against code, use the truncated row.

Because most languages truncate the quotient toward zero rather than rounding it down, and the two only differ when the dividend is negative. In JavaScript, -7 % 3 is -1, not 2. Python is the common exception: its % follows the sign of the divisor, so -7 % 3 is 2 there. None of them is wrong; they picked different conventions.

Yes, and that is exactly why neither can be called incorrect. For -7 divided by 3: -3 x 3 + 2 = -7, and -2 x 3 + (-1) = -7. The identity dividend = divisor x quotient + remainder holds either way. What differs is which quotient you round to, and arithmetic alone does not settle that.

The calculator refuses. There is no number of times zero fits into anything, so there is no quotient and no remainder to report. Returning infinity or zero would be inventing an answer to a question that does not have one.

That the division came out exactly, which is the same as saying the dividend is a multiple of the divisor. Checking for a zero remainder is the standard way to test divisibility: 100 divided by 7 leaves 2, so 100 is not a multiple of 7; 98 leaves 0, so it is.

The quotient is 0 and the remainder is the dividend itself. Seven goes into three zero times with three left over. That is a correct answer rather than an edge case to work around, and it is what makes remainder arithmetic useful for wrapping values into a range.

No. Quotient and remainder are defined for whole numbers, and the calculator rejects non-integers rather than guessing. For decimals the leftover after division is just ordinary division, with no separate remainder to report.

They run the same arithmetic and speak to different readers. Use this page for long division: quotient, remainder, and checking work done by hand. Use the mod calculator if you are thinking in programming terms, where the same operation wraps an index around an array length, buckets a hash, or tests divisibility.

No. Everything you type is processed by the page in your browser. Nothing is sent to a server, nothing is stored after you close the tab, and there is no account.

Yes. Remainder is defined for integer division. If you enter a decimal, the calculator flags it. For decimal division, use the long-division calculator or a basic calculator instead.