Long subtraction with regrouping

Subtract two numbers and see every borrow (regrouping) shown above the column, exactly like the paper method.

Long subtraction inputs

Difference
3,164
Borrows performed
3
Check (a − b + b)
6,043

How regrouping (borrowing) works

  1. Stack the two numbers with their units digits aligned; bigger number on top.
  2. Start at the right-most column. If the top digit is ≥ the bottom digit, just subtract.
  3. If the top digit is smaller, borrow 1 from the next column to the left: the top digit gains 10, and the column you borrowed from drops by 1.
  4. Move one column left and repeat. If the column you need to borrow from is 0, keep going further left until you find a non-zero digit and propagate the borrow back.
columnk: if ak < bk, set ak ← ak + 10 and ak+1 ← ak+1 − 1; then digit = ak − bk

FAQ

What if the subtrahend is bigger than the minuend?

The result is negative. The calculator swaps the operands internally, performs long subtraction, and writes the result with a leading minus sign.

How does borrowing across zeros work?

If you need to borrow from a 0, that 0 turns into 9 and you keep borrowing one column further left. The calculator shows the chain of changes above the column.

Related calculators