Home›Maths›Remainders Explained

Remainders Explained: Long Division, Modulo, and Negative Numbers

The remainder is what is left after dividing as many whole times as possible. It is also the modulo operation, the clock, and the check digit — this guide covers all three.

7 min readUpdated October 2026Remainder Calculator

A remainder is what is left over when one whole number is divided by another as many whole times as possible: 17 ÷ 5 gives 3, with 2 left over. That leftover — 2 — is the remainder, and it carries more mathematics than its size suggests. It is the modulo operation in computing, the arithmetic of clocks and calendars, and the check digit in barcodes and account numbers. This guide covers long division by hand, the modulo operation and its notation, negative dividends, and the remainder theorem — four faces of one idea.

Key takeaways
  • Remainder = dividend − (quotient × divisor), with the quotient the whole-number result. 17 ÷ 5: quotient 3, 3 × 5 = 15, remainder 17 − 15 = 2. The remainder is always smaller than the divisor.
  • Modulo is the same operation in computing: 17 mod 5 = 2. The notation is a % b in most programming languages, and it is the engine of clock arithmetic — 25 hours is 1 o’clock, because 25 mod 12 = 1.
  • Negative dividends split languages: truncated division gives −17 mod 5 = −2 (C, Java), floored division gives 3 (Python). The difference is the sign convention, not the arithmetic — know which one your tool uses before relying on it.

Long division by hand: the remainder appears last

Long division finds the quotient digit by digit, and the remainder is what is left when no more digits can be brought down. Take 431 ÷ 7. 7 goes into 43 six times (6 × 7 = 42), leaving 1; bring down the 1 to make 11; 7 goes into 11 once (1 × 7 = 7), leaving 4. The quotient is 61 and the remainder is 4. Check: 61 × 7 + 4 = 427 + 4 = 431. The check — quotient × divisor + remainder = dividend — is the division algorithm in one line, and it verifies every division, including the remainder.

The remainder is always smaller than the divisor, and it is never negative in ordinary arithmetic: 0 ≤ remainder < divisor. If a proposed remainder is 7 when dividing by 5, the division is not finished — 5 goes in at least once more. If a remainder is negative, the quotient is one too large. These two bounds are the remainder’s definition in disguise: the remainder is the unique number in that range that makes the check equation true. Any division whose remainder falls outside the range has been done wrong, whatever the quotient looks like.

When the divisor is larger than the dividend, the quotient is 0 and the remainder is the dividend itself: 3 ÷ 5 gives quotient 0, remainder 3. Nothing was divided, so everything is left. The rule is worth stating because it is the edge case that breaks naive expectations: dividing a small number by a big one does not give a small quotient with a remainder of 0 — it gives the number itself, untouched. The Remainder Calculator shows the quotient and remainder side by side for exactly this reason: the pair is the answer, not the quotient alone.

Modulo: the remainder as an operation

Modulo — written a mod b, or a % b — is the remainder operation, promoted to a first-class operation. In mathematics, a mod b is the remainder on dividing a by b, in the range 0 to b − 1. In computing, the % operator computes it, and it appears wherever repetition is involved: the day of the week after n days (mod 7), the hour after n hours (mod 12 or 24), the position in a circular buffer, the hash of a key into a table. Each is the same question: how far past the last whole cycle are we.

Modular arithmetic — arithmetic carried out modulo some number — keeps only remainders and discards the cycles. Mod 12, 10 + 5 = 3, because 15 leaves a remainder of 3 after one full cycle of 12. Mod 7, the days of the week add the same way: Friday plus 4 days is Tuesday, because 5 + 4 = 9, and 9 mod 7 = 2, counting from the same start. The point of modular arithmetic is that it never grows: every result stays inside the range 0 to b − 1, however large the inputs, which is why it is the arithmetic of computers, which have finite registers, and of clocks, which have finite faces.

Two properties are used constantly. Addition and multiplication can be done before or after taking the remainder — (a + b) mod m equals ((a mod m) + (b mod m)) mod m, and likewise for multiplication — which lets a long computation be reduced at each step instead of at the end. And a number is divisible by m exactly when its remainder mod m is 0: the divisibility tests are remainder tests. A number is even when n mod 2 = 0; it is divisible by 3 when the sum of its digits is divisible by 3, which is a consequence of 10 mod 3 = 1. The remainder is the test, and the tests are the remainder.

Negative dividends: where languages disagree

Negative numbers expose a genuine ambiguity. −17 ÷ 5: the quotient could be −3 with remainder −2 (truncation toward zero), or −4 with remainder 3 (flooring toward negative infinity). Both satisfy the check equation: −3 × 5 + (−2) = −17, and −4 × 5 + 3 = −17. The arithmetic cannot decide between them; the convention must. Mathematics usually takes the floored form, with the remainder in 0 ≤ r < divisor, giving −17 mod 5 = 3. Computing languages split: C, C++, Java, and JavaScript truncate, giving −2; Python, Ruby, and R floor, giving 3.

The practical consequence is a bug that appears only with negative inputs and only in some languages. Code that computes a weekday, an index, or a wrap-around with % will behave differently in Python and in C for negative values, and both will pass every positive test. The defence is to know the convention of the language in use and to test with negative inputs, or to normalise explicitly — ((a % b) + b) % b forces the floored result in any language. A calculator that reports a remainder for negative inputs should state its convention; this site’s calculator uses the floored convention, matching the mathematical definition, and says so in its notes.

The divisor’s sign is a second, smaller ambiguity. Dividing by a negative divisor, 17 ÷ −5, gives quotient −3 and remainder 2 under truncation, or quotient −3 and remainder 2 under flooring as well in this case — the conventions coincide more often for a negative divisor than for a negative dividend, but the rule to remember is the same: the remainder’s range is what the convention fixes, and the convention must be stated. For ordinary hand arithmetic, the rule is simple: keep the remainder non-negative and smaller than the divisor’s absolute value, and adjust the quotient to make the check equation true.

The remainder theorem: remainders without dividing

The remainder theorem says that dividing a polynomial by (x − a) leaves a remainder equal to the polynomial’s value at a: the remainder of P(x) ÷ (x − a) is P(a). Divide x² − 3x + 2 by (x − 1): P(1) = 1 − 3 + 2 = 0, so the remainder is 0, and indeed x − 1 is a factor. Divide x³ + 2x² − 5 by (x + 2): P(−2) = −8 + 8 − 5 = −5, so the remainder is −5 — verifiable by long division, which gives quotient x² + 0x + 0 and remainder −5. The theorem replaces a division with an evaluation, and it is the fastest factor test there is: a polynomial has (x − a) as a factor exactly when P(a) = 0.

Synthetic division is the hand method that computes both at once: it carries the coefficients down and multiplies by a, producing the quotient’s coefficients and, last, the remainder — which must equal P(a). It is the same arithmetic as long division, compressed. The theorem generalises: dividing by (x − a) where a is not a root gives the remainder, and repeated application gives the value of a polynomial at many points, which is the basis of polynomial interpolation and of the checksums that verify data.

The everyday relatives of the remainder theorem are the check digits. A barcode’s last digit, an ISBN’s check digit, and a bank account’s check digits are all remainders, chosen so that the whole number satisfies a modular equation. A single mistyped digit breaks the equation, and the error is caught before the number is used. The remainder’s job in all of these is the same: a small, cheap number that certifies a large one. For the mechanics of dividing one whole number by another, with the working shown, see the guide to long division, which covers the full algorithm this guide’s remainder completes.

Calendars: the remainder that names the weekday

The weekday of a future date is a remainder problem. The days of the week cycle every 7, so the weekday after n days is the starting weekday advanced by n mod 7. The 1st of January 2026 is a Thursday. One hundred days later: 100 mod 7 = 2, so the weekday advances two days from Thursday, to Saturday — the 11th of April 2026, which is indeed a Saturday. The year, the month lengths, and the leap days are all irrelevant to the weekday once the starting weekday and the number of days are known; the remainder does the whole job.

The same arithmetic runs backward. The weekday 100 days before Thursday the 1st of January 2026: 100 mod 7 = 2, so go back two days from Thursday, to Tuesday — the 23rd of September 2025. And the interval between two dates, in weeks and days, is a division with remainder: 100 days is 14 weeks and 2 days, which is the same remainder stated differently. Calendar algorithms — the Doomsday rule, Zeller’s congruence, the perpetual calendar — are all remainder arithmetic dressed in month tables, and each of them reduces, at its core, to counting days mod 7 from a known anchor.

Anniversaries and schedules inherit the cycle. A weekly event falls on the same weekday forever, because 7 mod 7 = 0. A fortnightly event alternates between two weekdays only if the interval is not a multiple of 7 — a 14-day interval returns to the same weekday, while a 10-day interval cycles through the week. A monthly event drifts, because months are 28 to 31 days, and 28 mod 7 = 0 while 30 mod 7 = 2 and 31 mod 7 = 3: a monthly meeting on the 15th falls on a different weekday most months, and the drift is the remainder of the month’s length. The remainder is the calendar’s engine, and every scheduling surprise is a remainder that was not computed.

Frequently asked questions

What is the remainder of 17 divided by 5?

2. Five goes into 17 three times (3 × 5 = 15), leaving 17 − 15 = 2. The quotient is 3 and the remainder is 2, and the check is 3 × 5 + 2 = 17.

What does 17 mod 5 mean?

It means the remainder when 17 is divided by 5, which is 2. Modulo is the remainder operation: a mod b is the remainder on dividing a by b, in the range 0 to b − 1.

Can a remainder be bigger than the divisor?

No. The remainder is always smaller than the divisor and never negative in ordinary arithmetic: 0 ≤ remainder < divisor. If a proposed remainder is 7 when dividing by 5, the division is not finished.

What is the remainder when the dividend is negative?

It depends on the convention. Mathematics and Python floor the division, giving −17 mod 5 = 3; C, Java, and JavaScript truncate toward zero, giving −2. Both satisfy quotient × divisor + remainder = dividend. Know which convention your tool uses.

What is the remainder theorem?

Dividing a polynomial P(x) by (x − a) leaves a remainder equal to P(a), the polynomial’s value at a. It is the fastest factor test: (x − a) is a factor exactly when P(a) = 0.

What is a remainder used for in real life?

Clock and calendar arithmetic (mod 12, mod 7), circular buffers and hashing in computing, check digits in barcodes, ISBNs, and bank accounts, and divisibility tests — anywhere a cycle repeats and only the position inside the cycle matters.

Try it on the calculator

Run your own figures through the calculator and see the answer in numbers.

Open the Remainder Calculator →
Sources: division algorithm, modular arithmetic, and the remainder theorem are standard elementary mathematics; the language-convention split is documented in the C, Java, JavaScript, and Python language references. This article is general educational information.
Related guides

Similar Posts