Subtract one binary number from another exactly, including negative results – and see why hardware actually subtracts by adding the two’s complement.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Borrows worth two
Binary subtraction borrows exactly as decimal does, except a borrow is worth 2: a 0−1 column becomes 10−1 = 1 with the next column reduced. Cascades through runs of zeros are where hand subtraction fails — 1000−1 flips every zero — and where the tool’s explicitness earns its keep.
Negative differences are delivered with a sign, and the steps note the two’s-complement route hardware actually takes.
Worked example
10110 − 1101 col 1: 0−1 → borrow: 10−1 = 1 col 2: 1−0−1(borrow) = 0 col 3: 1−1 = 0 col 4: 0−1 → borrow: 10−1 = 1 col 5: 1−0−1 = 0 Difference: 1001 (22 − 13 = 9 ✓)
How the ALU really does it
No borrow logic exists in hardware: a − b computes as a + (~b) + 1 through the ordinary adder, top carry discarded at width. One circuit, two operations — the design insight that made two’s complement universal, and the reason the Two’s Complement Calculator sits one link away.
Self-checking
Difference plus subtrahend must reproduce the minuend: 1001 + 1101 = 10110 ✓. The addition calculator closes that loop in one paste — a two-tool verification habit worth keeping.
Privacy
Computed in-page; never uploaded.
Borrowing in base two
Hand subtraction in binary borrows exactly like decimal, except a borrow is worth two instead of ten. Working 1010 − 0111 right to left: 0 minus 1 borrows to make 10₂ minus 1 = 1, the borrow ripples, and the result is 0011 — ten minus seven is three, confirmed in decimal. Real hardware almost never does this: a CPU subtracts by adding the two’s complement of the second operand, reusing the adder it already has, which is exactly the identity this calculator lets you check for any pair of values.
How to use the Binary Subtraction Calculator
- Enter minuend and subtrahend.
- Click "Subtract".
- The result may be negative; the steps outline the borrow method and the two's-complement view hardware uses.
- Verify against the decimal line.
Frequently asked questions
How does binary borrowing work?
When a column reads 0−1, borrow from the next left column: the 0 becomes 10 (two), giving 10−1=1, and the lender is reduced by one – identical to decimal borrowing but the borrow is worth 2, not 10.
How does hardware avoid borrowing entirely?
It adds the two's complement: a − b = a + (~b + 1), discarding the top carry at fixed width. One adder does both jobs – the reason two's complement won. The steps note this equivalence for your operands.
What if the subtrahend is larger?
You get a proper negative result with a minus sign. At fixed width a CPU would wrap (borrow flag set); the pure-math view shown here keeps the sign explicit instead.
Can I verify with addition?
Always: difference + subtrahend must equal the minuend. The Binary Addition Calculator closes the loop – a two-tool self-check.
Does the calculator handle very long patterns?
Yes – exact BigInt subtraction at any length, no precision cliffs.
Why does my hand answer differ in the low bits?
Almost always a missed borrow cascade through consecutive zeros: 1000 − 1 = 111 turns three zeros into ones. The steps make cascades explicit so the failure point is findable.
Local computation?
Yes – performed in-page, never uploaded.