Remainder Calculator

Divide one number by another and get the whole-number quotient and the remainder, with the check a = q × b + r. Handles huge numbers, decimals and negatives, where C, Python and Excel give different answers.

Calculator Numbers & Math Updated Oct 3, 2026
How to Use
  1. Type the dividend (the number being divided) and the divisor.
  2. If either is negative, choose the convention: floored (Python, Excel), truncated (C, Java, JavaScript) or Euclidean.
  3. Read the answer as “q r remainder”, plus the quotient, the remainder and the exact decimal quotient.
  4. The table compares all three conventions; Show Work checks q × b + r = a.
  5. The bar shows the dividend cut into groups the size of the divisor, with the remainder left over.
Input
Presets
Groups and remainder
Answer
—
Quotient
—
Remainder
—
Exact quotient
—

Worked Example

250 eggs in cartons of 12. 250 ÷ 12 = 20.8(3), so 20 full cartons. 20 × 12 = 240, and 250 − 240 = 10 eggs left over: 250 = 20 × 12 + 10.

A negative number: −17 ÷ 5. The exact quotient is −3.4. Truncating toward zero gives −3, and −17 − (−3 × 5) = −2, which is what C and JavaScript return. Rounding down to −4 gives −17 − (−4 × 5) = 3, which is what Python returns.

The common mistake: reading the decimal as the remainder. 17 ÷ 5 = 3.4, but the remainder is not 4. The 0.4 is a fraction of the divisor: 0.4 × 5 = 2.

Show Work

Enter two numbers to see the step-by-step working.

Formulas

Division with remainder
a = q × b + r
Truncated
q = trunc(a / b)
r has the sign of a
Floored
q = ⌊a / b⌋
r has the sign of b
Euclidean
0 ≤ r < |b|
Remainder from the decimal
r = (a / b − q) × b

Remainders and Clocks

The division algorithm, that any whole number can be written as q × b + r with a remainder smaller than b, goes back to Euclid’s Elements (about 300 BC), where repeated division with remainder finds the greatest common divisor. Carl Friedrich Gauss turned remainders into a whole branch of mathematics in 1801 with modular arithmetic, writing 17 ≡ 2 (mod 5) for numbers that leave the same remainder.

Remainders run calendars, clocks, check digits on barcodes and credit cards, hash tables and cryptography. The disagreement over negatives is newer: early Fortran truncated, and C followed it; mathematicians and later languages such as Python chose the floored version because it keeps clock arithmetic working.

About This Calculator

This calculator finds the quotient and remainder of any two numbers, including whole numbers with hundreds of digits and decimals, exactly. For negative numbers it shows the truncated, floored and Euclidean answers side by side, so you can match what your programming language or spreadsheet does.

Everything runs in your browser; nothing is sent anywhere.

Related calculators: Long Division Calculator, GCF and LCM Calculator, and Fraction Calculator.

Frequently Asked Questions

How do I find a remainder?

Divide, keep the whole-number part, multiply back and subtract. 17 ÷ 5 = 3.4, so the quotient is 3; 3 × 5 = 15 and 17 − 15 = 2. So 17 ÷ 5 = 3 remainder 2, and the check is 3 × 5 + 2 = 17. The remainder is always smaller than the divisor.

Why do programming languages disagree about the remainder of a negative number?

They round the quotient differently. C, C++, Java, C# and JavaScript truncate toward zero: −17 ÷ 5 → −3, so −17 % 5 = −2. Python, Ruby and Excel’s MOD round down toward −∞: −17 ÷ 5 → −4, so the remainder is 3. Both satisfy a = q × b + r; they just choose a different q.

What is the Euclidean remainder?

The convention where the remainder is never negative: 0 ≤ r < |b|. It agrees with Python when the divisor is positive, but for 17 ÷ −5 Python gives −4 r −3 while the Euclidean answer is −3 r 2. Number theory uses it, because the remainder then always names one of the |b| residue classes.

What is the difference between remainder and modulo?

For positive numbers they are the same thing. “Mod” often means the floored or Euclidean version, the one used in clock arithmetic: 3 hours before 2 o’clock is (2 − 3) mod 12 = 11. A truncated remainder would give −1, which is not a time on the clock.

Can I get a remainder with decimals?

Yes: the same rule works. 7.5 ÷ 2 = 3 remainder 1.5, because 3 × 2 + 1.5 = 7.5. This is what fmod in C and % on floats in most languages compute, though in binary floating point the answer can be slightly off; here it is exact.

How do I use the Remainder Calculator?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Sharing out

17 cookies among 5 children: 3 each, 2 left over.

Time

100 minutes is 1 hour remainder 40 minutes.

Programming

Check why −17 % 5 is −2 in JavaScript but 3 in Python.

Calendars

100 days from a Monday: 100 = 14 × 7 + 2, so a Wednesday.

Packing

250 eggs in cartons of 12: 20 full cartons and 10 left.

Last updated: