Skip to main content

Binary Subtraction

Subtraction in binary may be carried out by using a process called Twos Complement. This relies on certain underlying properties of binary numbers that enable us to represent a positive number as a negative number. As ( a - b ) is the same as ( a + ( -b )) we can use this trick to perform subtractions with negative numbers and additions.

Negating a binary number uses the Flip and Add method. All the bits in the number are flipped; which is to say 0 becomes 1 and 1 becomes 0. (See the section on logical NOT for more information.) 1 is then added to this number to give the negative. For example:

Action Binary Denary
01100010 98
- 00101111 47
FLIP 11010000
ADD 1 11010001
Add to 98 00110011 51

NB All binary numbers must use the same number of digits. In this case numbers are padded with 0 where necessary

When working with negative numbers the range of numbers changes. For example an 8 bit number goes from 00000000 to 11111111 or 0 to 255. If negative numbers are used then the range changes. The 8 bits still have 256 possible values but the range changes to values between 127 and -128.



Subtract 28 from 91. Remember to convert to binary first!

91 - 28 is 01011011 - 00011100. Note that both numbers are padded to eight bits.

To convert 28 to -28 we flip the bits and add 1. Flipping gives us 11100011. Adding 1 is 11100100. The sum is now 01011011 + 11100100 which is 00111111 or 63.

NB the extra carry at the end simply "falls off the end". The answer stays at eight bits.

Check your answer

Next: Hexadecimal Subtraction