radixflip

Binary Subtraction Calculator

Type two binary numbers and the difference appears instantly as you type — no Calculate button; the result updates on every keystroke, in every base. Borrow rules and a worked example are below.

Subtract Binary Numbers

1010₂ − 101₂ — the result appears here, live.

Full binary calculator (all operations) →  ·  Binary addition calculator →

How to subtract binary numbers

  1. Line up the numbers. Right-align them, the number you are subtracting underneath.
  2. Subtract column by column, right to left. 1 − 0 = 1, 1 − 1 = 0, 0 − 0 = 0.
  3. Borrow when a column needs 0 − 1. Take 1 from the next column to the left: your 0 becomes 10 (two), so 10 − 1 = 1. The column you borrowed from drops by 1.
  4. Follow the borrow if it cascades. If the next column is also 0, the borrow travels left until it finds a 1; every 0 it passed becomes 1 as the borrow comes back.

Binary subtraction rules

ColumnResult bitBorrow
0 − 000
1 − 010
1 − 100
0 − 111 (from the next column)

Worked example: 1010₂ − 101₂ = 101₂

Column (right to left)ABBorrow inDifferenceBorrow out
1st0101 (10 − 1)1
2nd1010 (1 − 0 − 1)0
3rd0101 (borrow again)1
4th1010 (1 − 0 − 1)0

Read the Difference column bottom to top: 0 1 0 1 → 101. Check in decimal: 10 − 5 = 5, and 101₂ is 5₁₀.

Common mistake: losing track of the borrow

The classic binary subtraction error is forgetting that a borrowed-from column drops by 1 — so the next column starts one short. Cascading borrows make it worse: in 1000 − 1, the borrow travels past two zeros, turning them into 1s, and the answer is 111, not 1001 − something. When a subtraction has a borrow, do the decimal check afterwards: convert both numbers, subtract in decimal, and compare. The calculator above does that check for you in its result grid.

Frequently asked questions

How do I subtract binary numbers?

Work column by column from right to left, just like decimal subtraction. 1 − 0 = 1, 1 − 1 = 0, 0 − 0 = 0. When a column needs 0 − 1, borrow 1 from the next column to the left: that turns your 0 into 10 (binary two), so 10 − 1 = 1, and the column you borrowed from drops by 1. The calculator above handles the borrows live.

What is 1010 − 101 in binary?

1010 − 101 = 101 in binary. In decimal that is 10 − 5 = 5, and 101 is 5. The middle column is where the borrow happens: 0 − 1 is impossible, so it borrows and becomes 10 − 1 = 1.

What are the binary subtraction rules?

0 − 0 = 0, 1 − 0 = 1, 1 − 1 = 0, and 0 − 1 = 1 with a borrow of 1 from the next column. A borrow can cascade: if the next column is also 0, the borrow travels left until it finds a 1, turning every 0 it passes into 1 on the way back.

What happens when the answer would be negative?

On paper, swap the numbers, subtract the other way, and put a minus sign on the result. This calculator does exactly that for you: subtract a larger number from a smaller one and you get a negative result with the correct magnitude. (Hardware uses two's complement instead — see the complement tool below.)

How do I subtract binary numbers in Python?

Use int(a, 2) − int(b, 2), then bin(result)[2:] for non-negative results. Example: bin(int("1010", 2) - int("101", 2))[2:] gives "101". For negative results, bin() keeps the minus sign: bin(-5) is "-0b101".