Long Division Calculator with Remainder

Enter a dividend and a divisor and this calculator returns the quotient and remainder, the exact decimal value, and the complete long-division layout one digit at a time — the working value, the quotient digit, what you subtract and what is left. Continue past the decimal point for as many places as you need. Remainders follow the Euclidean convention, so they are always zero or positive even when the dividend or the divisor is negative, which is the convention mathematics uses and most programming languages do not.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Dividend (the number being divided)The number that goes inside the division bracket. Whole numbers only; decimals are rounded.1234
Divisor (the number you divide by)The number outside the bracket. It must not be zero.7
Continue past the point forHow many extra zeros to bring down after the whole-number part is finished.4 decimal places

It returns

  • Answer — The whole-number quotient with its remainder, the way a division question is usually answered.
  • Quotient (whole part)
  • Remainder — Always at least zero and less than the size of the divisor.
  • Exact decimal quotient
  • Remainder as a share of the divisor — The fractional part of the answer, expressed as a percentage.

The formula

a=qb+r,0r<|b|
ab=q+r|b|

In plain text: a = q·b + r, with 0 ≤ r < |b|

  • aDividend — the number being divided (integer)
  • bDivisor — must not be zero (integer)
  • qQuotient — how many whole times b fits into a (integer)
  • rRemainder — what is left over, never negative (integer)

For any integers a and b with b ≠ 0 there is exactly one pair (q, r) satisfying both conditions. That uniqueness is the division algorithm, and it is what makes remainders well defined.

Updated Category Number Theory, Divisors & Number Systems Verified against published test cases Reading time 11 min

What a remainder is, precisely

Divide 1,234 by 7 and you cannot land on a whole number. Seven fits 176 whole times, using up 1,232, and 2 is left over. Written as an equation:

1234 = 7 × 176 + 2

That is the shape of every division with a remainder, and the statement that it always works is the division algorithm: for any integers a and b with b ≠ 0, there is exactly one pair of integers q and r such that a = qb + r and 0 ≤ r < |b|. Both halves matter. Without the size condition on r you could write 1234 = 7 × 175 + 9, or 7 × 100 + 534, and the remainder would mean nothing. Pinning r below |b| is what makes it unique, and uniqueness is what lets an entire branch of mathematics be built on top of it.

The name “algorithm” is slightly misleading — it is a theorem about existence and uniqueness, not a procedure. Long division is the procedure that finds the pair, and it is efficient because it works one digit at a time rather than subtracting the divisor over and over.

Everything downstream depends on this. Divisibility is the statement r = 0. Modular arithmetic is the study of r on its own, which is what the modulo calculator works with. Euclid's algorithm for the greatest common factor is repeated application of the division algorithm, taking the remainder each time until it hits zero. And prime factorisation is a hunt for the divisors that leave no remainder.

How the long-division layout works

Long division processes the dividend left to right, one digit at a time, carrying the leftover forward. At each step you hold a working value, ask how many whole times the divisor fits into it, write that as the next quotient digit, subtract what it accounts for, and bring down the next digit of the dividend.

The reason it works is positional notation. When you have used up part of the dividend and carry a remainder to the next column, multiplying that remainder by ten and adding the next digit is exactly the value that remains to be divided at that place. So the digits of the quotient come out in order, most significant first, and each one is a single-digit division you can do in your head.

Two features of the layout confuse people the first time. Leading zeros in the quotient are normal when the divisor is bigger than the first few digits of the dividend: dividing 3 by 7 has a first quotient digit of 0 because 7 does not fit into 3 even once. The decimal part is not a different procedure — when the digits of the dividend run out you simply bring down zeros, which is the same as writing 1234 as 1234.0000 and continuing.

That continuation reveals whether the decimal terminates or repeats. The remainder at each step is one of the values 0, 1, …, b−1, so within b steps either the remainder hits zero and the decimal stops, or a remainder repeats and the whole block of quotient digits from that point repeats forever. This is why 1 ÷ 3 = 0.333… never ends: the remainder is 1 at every step. It is also why the repeating block of a fraction can never be longer than one less than the denominator. The fraction to decimal calculator identifies the repeating block explicitly.

Worked example: 1,234 ÷ 7, then on past the decimal point

Set up 7 outside the bracket and 1234 inside, and work the digits left to right.

  1. Bring down 1. Working value 1. Seven fits 0 times. Write 0, subtract 0, remainder 1.
  2. Bring down 2. Working value 1×10 + 2 = 12. Seven fits 1 time. Write 1, subtract 7, remainder 5.
  3. Bring down 3. Working value 5×10 + 3 = 53. Seven fits 7 times. Write 7, subtract 49, remainder 4.
  4. Bring down 4. Working value 4×10 + 4 = 44. Seven fits 6 times. Write 6, subtract 42, remainder 2.

The digits are 0, 1, 7, 6, so the quotient is 176 and the remainder is 2. Check: 7 × 176 = 1,232, and 1,232 + 2 = 1,234. ✓

Continuing past the point. The dividend's digits are exhausted, so bring down zeros.

  1. Working value 2×10 = 20. Seven fits 2 times. Write 2, subtract 14, remainder 6.
  2. Working value 60. Seven fits 8 times. Write 8, subtract 56, remainder 4.
  3. Working value 40. Seven fits 5 times. Write 5, subtract 35, remainder 5.
  4. Working value 50. Seven fits 7 times. Write 7, subtract 49, remainder 1.

So far 176.2857, and the remainders so far are 2, 6, 4, 5, 1. Two more steps give quotient digits 1 and 4 with remainders 3 and 2 — and 2 is the remainder we started the decimal part with, so the block 285714 repeats forever: 1234 ÷ 7 = 176.285714285714…

The remainder 2 as a fraction of the divisor is 2 ÷ 7 = 0.285714, which is exactly the decimal part, as it must be: a/b = q + r/b. Expressed as a percentage that is 28.5714% of one whole divisor left over.

Which answer you actually want: remainder, decimal, or rounded

The same division supports three different answers, and choosing wrongly is a modelling error rather than an arithmetic one.

Take the remainder when the things being divided cannot be split. 1,234 people into buses of 7 gives 176 full buses and 2 people who still need transport — so you need 177 buses. Notice that the useful answer here is the quotient rounded up, and the remainder is what tells you a rounding up is needed at all.

Take the decimal when the quantity is continuous. 1,234 litres shared between 7 tanks is 176.2857 litres each, and there is nothing left over because litres divide.

Take the rounded quotient when you want a representative figure. An average of 176.29 per group is a summary, not an allocation, and it should be rounded to a sensible precision rather than reported to ten places. The rounding calculator covers the tie-breaking rules.

Watch the sign convention. This calculator uses the Euclidean convention: the remainder is always in the range from 0 up to just below |b|, so −17 ÷ 5 gives quotient −4 and remainder 3, since −17 = 5(−4) + 3. Most programming languages instead truncate the quotient toward zero, giving −3 remainder −2 for the same division. Both satisfy a = qb + r; they differ in which pair they pick. Mathematics uses the non-negative one because it makes remainders line up with congruence classes; C, Java and JavaScript use the truncating one because it matches the hardware instruction. If you are checking hand work against code output, this is very often the discrepancy.

Dividing 1,234 by each small divisor, with the quick divisibility test

The divisibility rules give the remainder without doing the division. Each quotient and remainder here satisfies 1234 = q·d + r.
Divisor dQuick test on 1234QuotientRemainder
2Last digit 4 is even6170
3Digit sum 1+2+3+4 = 10; 10 leaves 1 on division by 34111
4Last two digits 34; 34 = 4×8 + 23082
5Last digit 4, so 4 short of the next multiple2464
6Even but not divisible by 32054
7No simple test; 7×176 = 12321762
8Last three digits 234; 8×29 = 2321542
9Digit sum 10; 10 leaves 1 on division by 91371
11Alternating sum from the right 4−3+2−1 = 21122
12Divisible by 4 but not by 310210

The digit-sum tests for 3 and 9 work because 10 leaves a remainder of 1 on division by both, so every power of ten contributes its digit unchanged. The alternating-sum test for 11 works because 10 leaves a remainder of −1 on division by 11.

Where long division goes wrong

  • Forgetting a zero in the quotient. When the divisor does not fit into the current working value you must still write a 0 in that place before bringing down the next digit. Skipping it shifts every later digit and multiplies the answer by ten.
  • Bringing down more than one digit at a time. Each step handles exactly one digit. Pulling down two at once is a symptom of having missed a zero.
  • Letting the remainder reach or exceed the divisor. If a step leaves a remainder as large as the divisor, the quotient digit was too small. The remainder at every step must be strictly less than the divisor.
  • Losing the decimal point when you continue. Place the point in the quotient directly above its position in the dividend before you bring down the first zero, not afterwards.
  • Reading a truncated decimal as exact. Stopping at four places gives 176.2857, but the true value continues 285714 repeating. Say which you are quoting.
  • Applying the remainder to the wrong side of a real problem. A remainder of 2 people means one extra bus, not two-sevenths of a bus. Decide first whether the quantity divides.

Long division's place among the division methods

Short division is the same algorithm with the subtractions done mentally, carrying the remainder as a small digit written before the next figure of the dividend. It is faster for single-digit divisors and identical in principle; the long layout exists so the subtraction is visible and checkable.

Chunking, or partial quotients, subtracts convenient multiples of the divisor rather than insisting on the largest one at each place. Dividing 1,234 by 7 you might take 100 sevens (700), then 70 sevens (490), then 6 sevens (42), and add the chunks to get 176. It needs more writing but far less mental division, which is why many curricula teach it first. Long division is the limiting case where every chunk is the largest possible.

Polynomial long division uses the identical bookkeeping with powers of x in place of powers of ten. The division algorithm holds there too: any polynomial divided by a non-zero polynomial gives a unique quotient and a remainder of lower degree.

Two applications are worth knowing. Converting a number to another base is repeated division with remainder — the remainders, read in reverse, are the digits in the new base, which is exactly what the number base conversion calculator does. And finding every divisor of a number, as the factors calculator does, is a search for the divisions that leave remainder zero, which is why testing divisors only up to the square root suffices: past that point each new factor pairs with one already found.

Frequently asked questions

What is the remainder when 1,234 is divided by 7?

Two. Seven goes into 1,234 a whole 176 times, using 7 × 176 = 1,232, and 1,234 − 1,232 = 2 is what remains. Written as the division algorithm, 1234 = 7 × 176 + 2, with the remainder strictly less than the divisor. As a decimal the same division is 176.285714 with the block 285714 repeating.

Why can't I divide by zero?

Because no quotient would satisfy the definition. Division asks what number multiplied by the divisor gives the dividend; every number multiplied by zero gives zero, so for a non-zero dividend there is no answer at all, and for a zero dividend every number works and no single answer can be chosen. It is not that the answer is infinite — it is that the question has no unique solution, which is why the calculator reports it as undefined.

Should the remainder be negative when the dividend is negative?

Not under the convention this calculator uses. The Euclidean convention keeps the remainder from zero up to just below the size of the divisor, so −17 ÷ 5 gives quotient −4 and remainder 3. Most programming languages truncate the quotient toward zero instead, returning −3 remainder −2. Both satisfy a = qb + r; mathematics prefers the non-negative remainder because it lines up with congruence classes modulo b.

How do I know if a decimal will repeat or terminate?

Reduce the fraction to lowest terms and look at the denominator's prime factors. If they are only 2s and 5s the decimal terminates, because those are the prime factors of ten. Any other prime factor forces a repeat. So 1/8 terminates, 1/3 repeats, and 1/6 repeats after one non-repeating digit because 6 = 2 × 3. The repeating block can never be longer than one less than the denominator, since there are only that many possible non-zero remainders.

How do I check a long division answer?

Multiply the quotient by the divisor and add the remainder; you must recover the dividend exactly. For 1,234 ÷ 7: 176 × 7 = 1,232, plus 2 gives 1,234. ✓ Also confirm the remainder is smaller than the divisor — a remainder as large as the divisor means a quotient digit was too small. These two checks between them catch essentially every arithmetic slip.

Why does my quotient start with a zero?

Because the divisor does not fit into the leading digits of the dividend. Dividing 3 by 7, the first working value is 3 and seven fits zero times, so the first quotient digit is 0. That leading zero is not written in the final answer but the step is real and must be performed, and it is why the whole-number quotient is 0 with the entire dividend surviving as the remainder.

What is the difference between long division and short division?

Only the amount written down. Short division does the multiply-and-subtract mentally and carries the remainder as a small figure in front of the next digit, which suits single-digit divisors. Long division writes every subtraction out, which is slower but makes each step checkable and works for divisors of any size. The underlying algorithm and the answer are identical.

When should I round up instead of using the remainder?

Whenever a leftover still needs a whole unit of capacity. Dividing 1,234 passengers among 7-seat vehicles gives 176 full vehicles and 2 passengers left, so you need 177 vehicles — the remainder is the signal to round up, not something to discard. When the quantity divides freely, such as litres or money, take the decimal instead and round only for presentation.

References

  • An Introduction to the Theory of Numbers, 6th edition (the division algorithm) — Oxford University Press (Hardy and Wright)
  • Concrete Mathematics: A Foundation for Computer Science, 2nd edition (floor, ceiling and mod conventions) — Addison-Wesley (Graham, Knuth and Patashnik)
  • The Art of Computer Programming, Volume 2: Seminumerical Algorithms — Addison-Wesley (Donald E. Knuth)