Computers subtract by adding the two’s complement, so they need only an adder. Learning both the borrowing method and the complement method shows how negative numbers are handled in hardware.
How to use the Binary Subtraction Calculator
- Minuend (binary)
- Subtrahend (binary)
- Representation
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Enter the minuend and subtrahend in binary. Choose a bit width to see the two’s-complement calculation and the signed and unsigned results.
Formula
0 − 0 = 0, 1 − 0 = 1, 1 − 1 = 0, 10 − 1 = 1 (borrow)
A − B = A + (two's complement of B)
Worked example
Inputs: Minuend (binary): 1011; Subtrahend (binary): 111; Representation: 8-bit.
Results: Difference (binary) = 100; Difference (decimal) = 4; Minuend in decimal = 11; Subtrahend in decimal = 7; In the chosen bit width = 0000 0100 → unsigned 4, signed 4; Method = Subtract column by column, borrowing 10₂ = 2 when a digit is too small.
Two's-complement method (8 bits): 00001011 + 11111001 = 00000100 (drop the overflow bit).
Key terms
- Borrow
- Taking a unit from the next higher column.
Frequently asked questions
What is 1011 − 111?
100 (11 − 7 = 4).
How do computers subtract?
They add the two's complement of the subtrahend.
What if the result is negative?
In a fixed width it appears as a two's-complement pattern with a leading 1.
What is borrowing in binary?
Taking 1 from the next column, worth 2 in the current one.