Skip to content

Long Division Calculator with Remainder

Quotient and remainder of any two integers, with every step of the long division and the exact decimal.

Your details

A whole number, up to 200 digits; negative allowed.

Remainder convention

Only matters for negative numbers. Euclidean is the mathematical standard.

Results update as you type

Quotient (q)

341

Remainder (r)
22
a = b × q + r
7,865 = 23 × 341 + 22
As a mixed number
341 22/23
Exact decimal
341.(9565217391304347826086)

Step-by-step solution
  1. 78 ÷ 23 = 3; 3 × 23 = 69; 78 − 69 = 9
  2. Bring down 6 → 96 ÷ 23 = 4; 4 × 23 = 92; 96 − 92 = 4
  3. Bring down 5 → 45 ÷ 23 = 1; 1 × 23 = 23; 45 − 23 = 22
  4. Read the quotient on top: 341, remainder 22
  5. Check: 7,865 = 23 × 341 + 22

Long division, column by column

Dividing aa by bb with a remainder means finding the quotient qq (how many whole times bb fits into aa) and the remainder rr (what is left over), so that a=b×q+ra = b \times q + r. This long division calculator does it for whole numbers of any size, up to 200 digits, using exact integer arithmetic.

You get the quotient and remainder, the check a=b×q+ra = b \times q + r, the answer as a mixed number and the exact decimal, with any repeating block in brackets (1÷7=0.(142857)1 \div 7 = 0.(142857)). The column method taught in school is laid out step by step: divide, multiply, subtract, bring down the next digit, repeat.

Negative numbers are where calculators and programming languages disagree, so you can choose the remainder convention: Euclidean division (the remainder is always 0≤r<∣b∣0 \le r < |b|, the mathematical standard), truncated division (the remainder has the sign of the dividend, like the % operator in C, Java and JavaScript) or floored division (the sign of the divisor, as in Python and spreadsheet MOD functions).

How to use this calculator

  1. Enter the dividend aa (the number being divided) and the divisor bb. Thousands separators are accepted.
  2. Keep the Euclidean convention unless you need to match a programming language with negative numbers.
  3. Read the quotient and the remainder at the top, then the check line, the mixed number and the exact decimal.
  4. Open the steps or the table to follow the column method digit by digit.

The formula

Division theorem. For integers aa and b≠0b \ne 0 there is exactly one pair (q,r)(q, r) with

a=b q+r,0≤r<∣b∣a = b\,q + r, \qquad 0 \le r < |b|

This is Euclidean division. For b>0b > 0, q=⌊a/b⌋q = \lfloor a / b \rfloor and r=a−b⌊a/b⌋r = a - b\lfloor a/b \rfloor, written a mod ba \bmod b. The other conventions keep a=bq+ra = bq + r but pick a different qq:

Convention Quotient Sign of rr
Euclidean chosen so 0≤r<∣b∣0 \le r < \lvert b \rvert never negative
Truncated q=trunc⁡(a/b)q = \operatorname{trunc}(a / b) same as aa
Floored q=⌊a/b⌋q = \lfloor a / b \rfloor same as bb

Long division builds qq one digit at a time: take the leading digits of aa as a partial dividend pp, write the digit d=⌊p/b⌋d = \lfloor p / b \rfloor, subtract d×bd \times b, append the next digit of aa to the remainder, and repeat. Continuing past the decimal point with zeros gives the decimal expansion; since only ∣b∣|b| remainders are possible, the digits must eventually repeat.

Worked example

7865 ÷ 23 by long division:

Partial dividend Quotient digit Subtract Remainder
78 3 69 9
96 4 92 4
45 1 23 22

The quotient is 341 and the remainder 22: 7865=23×341+227865 = 23 \times 341 + 22. As a mixed number, 7865/23=341 22237865/23 = 341\,\tfrac{22}{23}, and as a decimal 341.(9565217391304347826086)341.(9565217391304347826086) (a block of 22 repeating digits).

Negative dividend, −17 ÷ 5: Euclidean gives q=−4q = -4, r=3r = 3 (since −17=5×(−4)+3-17 = 5 \times (-4) + 3); truncated gives q=−3q = -3, r=−2r = -2; floored gives the same as Euclidean here because the divisor is positive.

Quotient and remainder in everyday problems

  • Sharing: 7865 sweets shared among 23 classes: each gets 341 and 22 are left over.
  • Packing: how many boxes of 12 for 150 eggs? 150=12×12+6150 = 12 \times 12 + 6, so 12 full boxes and a 13th with 6 eggs. Here you round the quotient up.
  • Time: 500 minutes is 500=60×8+20500 = 60 \times 8 + 20, or 8 h 20 min.
  • Calendars: 100 days from a Monday: 100=7×14+2100 = 7 \times 14 + 2, so it falls on a Wednesday.
  • Divisibility: bb divides aa exactly when the remainder is 0, which is also the core step of Euclid’s algorithm in the GCD calculator.

What the remainder says about the decimal

When the remainder is 0 the division is exact. Otherwise the decimal part is r/br / b. It terminates when bb (after removing common factors with aa) has no prime factors other than 2 and 5, as with 7÷8=0.8757 \div 8 = 0.875; in every other case it repeats, with a period shorter than ∣b∣|b|: 1/7=0.(142857)1/7 = 0.(142857) repeats every 6 digits, 1/231/23 every 22. To round a long decimal result, use the rounding calculator.

Frequently asked questions

What are the quotient and the remainder?

In a ÷ b, the quotient is the number of whole times b fits into a, and the remainder is what is left over, always smaller than b. For 17 ÷ 5 the quotient is 3 and the remainder 2, because 17 = 5 × 3 + 2.

What is Euclidean division?

It is division of integers with a remainder that is never negative: a = bq + r with 0 ≤ r < |b|. The theorem that this pair (q, r) exists and is unique goes back to Euclid’s Elements and is the basis of modular arithmetic.

Why do calculators give different remainders for negative numbers?

Because they pick a different quotient. For −17 ÷ 5, truncated division (C, Java, JavaScript %) gives q = −3, r = −2; floored and Euclidean division give q = −4, r = 3. All satisfy −17 = 5q + r. Choose the convention that matches your course or language.

How do I write a remainder as a fraction or decimal?

Divide the remainder by the divisor: 7865 ÷ 23 = 341 remainder 22, which is 341 22/23 as a mixed number, or 341.9565… as a decimal. The calculator gives both, with the repeating digits in brackets.

Can I divide decimals with long division?

Yes: multiply both numbers by the same power of 10 to make them whole, then divide. 12.6 ÷ 0.3 becomes 126 ÷ 3 = 42. The quotient is unchanged, but the remainder is scaled by that power of 10, so divide it back if you need it.

Sources

Last updated:

More Math calculators

People also use