Skip to content
BinaryTo

Binary Subtraction

Binary subtraction goes column by column from the right. To take 1 from 0, borrow 1 from the next column to the left: the 0 becomes 10, and 10 − 1 = 1. Computers skip borrowing and add the two's complement instead.

Updated

The rules of binary subtraction

The rules of binary subtraction
DifferenceResultBorrow
0 − 00No
1 − 01No
1 − 10No
0 − 11Yes, from the next column

Worked example: 1010 − 0011

Line the numbers up on the right and work one column at a time.

  1. 01

    Column 1 (right)

    0 − 1 needs a borrow. Column 2 lends 1 and drops to 0, so this column is 10 − 1 = 1.

  2. 02

    Column 2

    Now 0 − 1 needs a borrow too. Column 3 is 0, so it borrows from column 4 first, then lends 1. This column is 10 − 1 = 1.

  3. 03

    Columns 3 and 4

    Column 3 has 1 left: 1 − 0 = 1. Column 4 lent its 1: 0 − 0 = 0. The answer is 0111, which is 7: 10 − 3.

Subtracting with 2's complement

Computers subtract by adding. To work out A − B, find the two's complement of B (invert every bit, then add 1), add it to A, and drop any carry past the leftmost column.

For 1010 − 0011 in 4 bits: 0011 inverts to 1100, plus 1 is 1101. Then 1010 + 1101 = 10111. Drop the leading carry and the answer is 0111, or 7.

If B is bigger than A, there is no carry to drop and the answer is negative, in two's complement: 0011 − 0101 gives 1110, which is −2. The two's complement calculator reads it for you.

Try it: subtract two binary numbers

Type two numbers to see where each borrow happens. Tick Signed (two's complement) to see the subtraction done by adding.

Binary calculator

Operation

Binary

Practice: 10 problems

Type each answer in binary. Leading zeros don't matter.

Frequently asked questions

How do you borrow in binary subtraction?

When the top bit is 0 and the bottom bit is 1, take 1 from the next column to the left. That 1 is worth 2 in the current column, so 0 becomes 10 and 10 − 1 = 1. If the next column is 0 too, keep going left until you reach a 1.

How do you subtract using 2's complement?

Invert every bit of the number you're subtracting, add 1, and add the result to the other number. Drop the final carry. 1010 − 0011 becomes 1010 + 1101 = 10111, so the answer is 0111.

What is 0 − 1 in binary?

On its own, −1. Inside a longer subtraction, 0 − 1 is 1 with a borrow from the next column. In 8-bit two's complement, −1 is 11111111.