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
Full binary calculator (all operations) → · Binary addition calculator →
How to subtract binary numbers
- Line up the numbers. Right-align them, the number you are subtracting underneath.
- Subtract column by column, right to left. 1 − 0 = 1, 1 − 1 = 0, 0 − 0 = 0.
- 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.
- 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
| Column | Result bit | Borrow |
|---|---|---|
| 0 − 0 | 0 | 0 |
| 1 − 0 | 1 | 0 |
| 1 − 1 | 0 | 0 |
| 0 − 1 | 1 | 1 (from the next column) |
Worked example: 1010₂ − 101₂ = 101₂
| Column (right to left) | A | B | Borrow in | Difference | Borrow out |
|---|---|---|---|---|---|
| 1st | 0 | 1 | 0 | 1 (10 − 1) | 1 |
| 2nd | 1 | 0 | 1 | 0 (1 − 0 − 1) | 0 |
| 3rd | 0 | 1 | 0 | 1 (borrow again) | 1 |
| 4th | 1 | 0 | 1 | 0 (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".