Skip to content
BetterDL

Binary subtraction

Also called: subtracting binary numbers, binary difference

Subtracting binary numbers column by column from the right, borrowing from the left when a column needs 0 − 1. Hardware adds the two's complement instead.

By hand, binary subtraction works like decimal subtraction. Go column by column from the right. The column rules:

  • 0 − 0 = 0
  • 1 − 0 = 1
  • 1 − 1 = 0
  • 0 − 1: borrow 1 from the left, then 10₂ − 1 = 1

The borrowed 1 is worth two in the receiving column, so the 0 becomes 10₂, and the column you borrowed from goes down by 1.

If the column to the left is also 0, the borrow passes through it, turning each 0 it crosses into 1, just as 1000 − 1 = 999 turns zeros into nines.

Hardware usually doesn't borrow at all. It uses twos complement subtraction: A − B = A + (inverted B) + 1, so the same adder handles both jobs. That's exactly what an adder subtractor does.

Worked examples

Example

1010₂ − 0011₂ (10 − 3), by borrowing

Two of the columns need a borrow.

  1. 1.

    Bit 0: 0 − 1. Borrow from bit 1, which drops from 1 to 0. Bit 0: 10₂ − 1 = 1.

  2. 2.

    Bit 1: now 0 − 1. Bit 2 is 0, so the borrow comes from bit 3, which drops to 0. Bit 2 becomes 1 and bit 1 becomes 10₂. Bit 1: 10₂ − 1 = 1.

  3. 3.

    Bit 2: 1 − 0 = 1.

  4. 4.

    Bit 3: 0 − 0 = 0.

  5. 5.

    Result: 0111 = 7 = 10 − 3.

Example

The same subtraction, the hardware way

−3 in 4 bits is 1101 (invert 0011, add 1). Then 1010 + 1101 = 1 0111. Drop the carry-out and keep 0111 = 7. No borrows needed.

Common mistakes

  • Forgetting that the lending column goes down by 1.

  • Borrowing ten instead of two out of decimal habit.

  • Keeping the carry-out of the add-the-negative method as part of the answer.

Practice Binary subtraction

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Binary subtraction is taught in Number Systems.