Remainder Calculator
Result
Quotient
- Remainder
- 2
- Check
- 5 * 9 + 2 = 47
A remainder is what is left of a whole number after the largest whole number of times the divisor fits into it has been taken away, and the quotient is how many times that was. For 47 and 5 the answer is unambiguous: 5 goes into 47 nine times, which is 45, and 2 is left, so the quotient is 9 and the remainder is 2. The two are tied together by a definition rather than a procedure — dividend equals divisor times quotient plus remainder — and that check is printed alongside them, because a quotient and a remainder are only correct as a pair. Where it stops being unambiguous is when the dividend or the divisor is negative, and that is the whole subject of this page. There are two conventions in wide use and they give different answers for the same input. Truncating discards the fractional part of the exact quotient, so the quotient moves towards zero, and the remainder takes the sign of the dividend: −47 ÷ 5 truncates to −9 with a remainder of −2. Flooring moves the quotient down to the next whole number instead, which makes the remainder non-negative: −47 ÷ 5 floors to −10 with a remainder of 3. Both satisfy the definition — 5 × −9 + −2 and 5 × −10 + 3 both come to −47 — so the definition alone cannot tell you which one a given tool means, and that is exactly why the convention is an input here rather than a hidden choice. The truncating one is the default because it is what most programming languages do and what most people mean by integer division; the flooring one is what modular arithmetic needs, since a negative remainder is useless in that setting. Note that the remaining special cases fall out of the definition. When the dividend is 0 the quotient and remainder are both 0. When the divisor is larger than the dividend, a positive dividend gives a quotient of 0 and a remainder equal to the dividend. And when the divisor goes in exactly, the remainder is 0 under either convention.
All four sign combinations of −47 and 5, under both conventions
| dividend | divisor | truncated | euclidean |
|---|---|---|---|
| -47 | 5 | -9 r -2 | -10 r 3 |
| -47 | -5 | 9 r -2 | 10 r 3 |
| 47 | -5 | -9 r 2 | -9 r 2 |
| 47 | 5 | 9 r 2 | 9 r 2 |
The whole page in four rows. Read the last two first: with both numbers positive, and with a positive dividend and a negative divisor, the two columns hold the same answer — 47 ÷ 5 is 9 remainder 2 either way, and 47 ÷ −5 is −9 remainder 2 either way. The conventions only part company once the dividend is negative. The first row is the case the page is built around: −47 ÷ 5 is −9 remainder −2 when truncated and −10 remainder 3 when floored, two correct decompositions of the same number. The second row shows that flipping the sign of the divisor changes the quotient and leaves the remainder convention behaving the same way, so the rule is not simply 'negative dividend means negative remainder'. Every entry satisfies dividend equals divisor times quotient plus remainder — check any of them — which is why the definition alone cannot pick between the two columns. The table does not follow your input; the panel above applies whichever convention you chose to your own numbers.
Formula
47 = 5 × 9 + 2 ⇒ quotient 9, remainder 2, and −47 = 5 × −10 + 3 under flooring versus −47 = 5 × −9 + −2 under truncation
- 47
- The dividend, the number being divided, a whole number from −1000000000 to 1000000000. Negative values are allowed and are the reason the convention field below exists. Decimals are refused rather than rounded, since a remainder is a statement about whole numbers
- 5
- The divisor, a whole number from −1000000000 to 1000000000. It cannot be 0: no quotient would satisfy the check. It may also be negative, and a negative divisor flips the sign of the quotient under both conventions — the check line is what keeps that straight
- truncated
- The convention that discards the fractional part of the exact quotient, moving it towards zero: −47 ÷ 5 gives −9 because −9.4 is truncated to −9. The remainder then carries the sign of the dividend and can be negative. This is what most programming languages produce and it is the default here
- euclidean
- The convention that moves the quotient down to the next whole number instead, so the remainder is never negative: −47 ÷ 5 gives −10 with a remainder of 3. Number theory and modular arithmetic require this one, because a negative remainder has no meaning when it stands for a position in a cycle. The two agree whenever both numbers are positive
- quotient 9
- How many whole times the divisor fits. Under truncation this is the exact quotient with its fractional part dropped; under flooring it is the exact quotient rounded down. The two differ by exactly 1 when the signs make the remainder negative, and never otherwise
- remainder 2
- What is left over, and the number the whole page is about. It is always smaller than the divisor in absolute value, and it is 0 whenever the division comes out exactly. Its sign is the whole difference between the two conventions: under truncation it follows the dividend, under flooring it never goes below 0
Dividing things into groups is the everyday case, and it is the one where the convention never matters: 47 items into groups of 5 gives 9 full groups with 2 left over, and nobody would call the answer −9 with −2 left over. The convention starts to matter the moment the numbers can go negative, and that happens more often than it looks. Integer division in programming is the common case — most languages truncate, so −47 / 5 is −9 and the remainder is −2, and code that assumes a non-negative remainder breaks on negative inputs. Modular arithmetic is the other side of it: clock times, calendar dates, cycling through a list, and computer arithmetic on fixed-width integers all need the flooring version, because 'three steps back from here' has to land on a real position in the cycle. In coursework the remainder under truncation is what is taught alongside long division, with negatives either excluded or handled by the same sign-follows-the-dividend rule. The check line is worth using in every one of these settings, because the two conventions produce quotients that differ by one and remainders that differ by the divisor, and both pairs satisfy the definition — a pair that does not satisfy it is a bug regardless of which convention was intended.
Worked examples
47 ÷ 5, where both conventions agree
- 5 goes into 47 nine times: 5 × 9 = 45
- 47 − 45 = 2, so 2 is left over
- The exact quotient is 9.4, and truncating it gives 9
- Flooring 9.4 also gives 9, so the two conventions agree here
- Check: 5 × 9 + 2 = 47
The default, and the case where the convention field makes no difference. Both conventions agree whenever the dividend and divisor have the same sign, which includes every pair of positive numbers — the choice only shows up once one of the two is negative. Reading the check as a sentence is the habit worth forming: the divisor times the quotient plus the remainder has to give back the dividend exactly.
−47 ÷ 5 truncating: the remainder goes negative
- The exact quotient is −47 ÷ 5 = −9.4
- Truncating discards the fractional part, moving the quotient towards zero: −9
- 5 × −9 = −45, which is 2 more than −47, so 2 has to be taken back: the remainder is −2
- The remainder carries the sign of the dividend, which is what makes it negative here
- Check: 5 × −9 + −2 = −47
The quotient is −9 rather than −10, and the remainder is −2 rather than 3. Both this pair and the next one satisfy the same definition, which is the point of the page: −9 with remainder −2 and −10 with remainder 3 are both correct decompositions of −47, and the convention is what decides which one you get. Most programming languages land here, so code that assumes a remainder is never negative will be surprised by this row.
−47 ÷ 5 flooring: the remainder stays non-negative
- The exact quotient is still −47 ÷ 5 = −9.4
- Flooring moves it down to the next whole number rather than towards zero: −10
- 5 × −10 = −50, which is 3 below −47, so 3 is left over: the remainder is 3
- The remainder is non-negative, which is what this convention guarantees
- Check: 5 × −10 + 3 = −47
Same dividend, same divisor, different answer — and this one is not a correction of the previous example. Flooring is what modular arithmetic needs, because a remainder standing for a position in a cycle cannot be negative; −47 modulo 5 is 3 in that setting, and every result of a modulo operation is expected to fall between 0 and the divisor. The quotient is one lower than under truncation, and the remainder is larger by exactly the divisor, which is the fixed relationship between the two conventions.
A negative divisor near the limit: 1000000000 ÷ −999999999
- The divisor is negative, so the exact quotient is negative: about −1.000000001
- Truncating towards zero gives −1
- −999999999 × −1 = 999999999, which is 1 short of 1000000000
- The remainder is 1, and it takes the sign of the dividend, which is positive
- Check: −999999999 × −1 + 1 = 1000000000
Both numbers sit at the edge of what the page accepts, and the quotient comes out as −1 because the divisor is just barely larger than the dividend in absolute value. The check line is the part worth reading: two negative numbers multiplying to a positive one, plus a remainder of 1, lands exactly on the dividend. A negative divisor flips the sign of the quotient under both conventions, while the remainder still follows the dividend.
Limitations
Both the dividend and the divisor must be whole numbers from −1000000000 to 1000000000 inclusive, and the divisor cannot be 0 under either convention — there is no number that, multiplied by 0, gives back a non-zero dividend, so no quotient and remainder could satisfy the check. Decimals are refused rather than rounded: a remainder is a statement about whole numbers dividing whole numbers. The convention field takes one of two values, truncating or flooring, and both are always available; there is no third option, and the page will not guess at which one you meant. With both numbers positive the choice makes no difference, and the two conventions never disagree about anything except the sign of the remainder and a quotient that differs by one. Under truncation the remainder can be negative, and that is the convention's behaviour rather than an error. The reference table below is fixed at ±47 and ±5 and does not follow your input: it lays out all four sign combinations so the two conventions can be compared side by side, and the panel above answers whatever you typed. Every value is exact — all four numbers are whole numbers well inside the range a machine holds precisely — so nothing here is ever rounded.
Frequently asked questions
- Why are there two answers for the same division?
- Because the definition only says the quotient times the divisor plus the remainder must give back the dividend, and for a negative dividend both a smaller quotient with a negative remainder and a larger quotient with a positive remainder satisfy it. −47 ÷ 5 is −9 remainder −2 when the quotient is truncated towards zero, and −10 remainder 3 when it is floored. Both are correct, and the convention decides which one you get.
- Which convention should I use?
- Truncating is the default here because it is what most programming languages produce and what most people mean by integer division — the quotient moves towards zero and the remainder takes the sign of the dividend. Take flooring when the remainder has to be non-negative: modulo in the mathematical sense, positions in a cycle, calendar arithmetic, and anything where the remainder is an index into a repeating list. With two positive numbers the choice makes no difference at all.
- What is the remainder when the divisor is negative?
- The same rule applies, with the sign of the quotient flipped. 47 ÷ −5 gives −9 with a remainder of 2 under truncation, because the remainder follows the dividend rather than the divisor. The divisor being negative changes the quotient's sign and leaves the remainder's sign rule alone, which is what the second row of the table shows.
- Is this the same as the modulo operation?
- Related, but not identical. Modulo returns only the remainder and is normally defined with a non-negative result, which is the flooring convention here. The difference shows on negative inputs: −47 modulo 5 is 3, while integer division with truncation returns −2. If what you want is a non-negative result, choose flooring; if you want the quotient rounded towards zero, choose truncating.
- What is the remainder when the division comes out exactly?
- Zero, under both conventions. When the divisor goes in a whole number of times nothing is left over, and the check reads divisor times quotient equals the dividend with no third term to worry about. A remainder of 0 is a normal answer and means the division was exact, not that the output failed.
- Why can the divisor not be zero?
- Because no quotient and remainder could satisfy the check. If the divisor is 0 then 0 times any quotient is 0, so the check would need the remainder to equal the dividend while also being smaller than the divisor in absolute value — impossible for any non-zero dividend, and for a dividend of 0 the answer would be every number at once rather than one answer. The page refuses it instead of returning something arbitrary.
References
- Remainder — the definition, the identity linking dividend, divisor, quotient and remainder, and the different conventions in use when signs are involved — Wolfram MathWorld (United States)
- Modular arithmetic — where the non-negative remainder convention comes from, and why a negative remainder is not usable as a position in a cycle — Wolfram MathWorld (United States)
- Division — the dividend, divisor and quotient, and the identity restated as the check the page prints — Wolfram MathWorld (United States)
- 教育部关于印发义务教育课程方案和课程标准(2022 年版)的通知——The fifth item in the annex list of this notice is the Mathematics Curriculum Standards for Compulsory Education (2022 edition); division with a remainder is part of the Number and Algebra strand of these standards, and the wording of the standards and the grade-band breakdown are governed by that annex — 中华人民共和国教育部