Binary Subtraction Calculator

Subtract one binary number from another and see every borrow, column by column.

Updated

Enter to calculate Esc to clear

Binary Subtraction Calculator

Our Binary Subtraction Calculator takes one binary number (the subtrahend) away from another (the minuend) and shows the difference in binary, decimal, hexadecimal and two’s complement. It lays out the column subtraction with every borrow marked, so you can check homework step by step, and it handles negative results when the subtrahend is the larger number.

Quick answer

Subtract binary numbers column by column from the right, using 0 − 0 = 0, 1 − 0 = 1, 1 − 1 = 0 and 0 − 1 = 1 with a borrow from the next column. For example, 1100 − 1010 = 10, which is 12 − 10 = 2 in decimal. Enter any two binary numbers above and the calculator shows the result and every borrow instantly.

  • Borrowing: a borrowed 1 is worth 2 in the column it moves to, so 0 − 1 becomes 10 − 1 = 1
  • Negative results: 1010 − 1100 = −10 (10 − 12 = −2), or 1111 1110 in 8-bit two’s complement
  • How computers do it: A − B = A + (NOT B + 1), dropping the final carry
  • Check it: difference + subtrahend = minuend

Binary Subtraction Rules

Binary has only two digits, so there are only four cases to learn for a single column:

ColumnResultBorrow
0 − 00No
1 − 01No
1 − 10No
0 − 11Yes, borrow 1 from the next column (10 − 1 = 1)

The Borrow Method

Write the larger number on top and work from the rightmost column to the left. When a column needs 0 − 1, borrow 1 from the column to its left. In binary, that borrowed 1 is worth 2 (just as a borrowed 1 in decimal is worth 10), so the column becomes 10 − 1 = 1, and the column you borrowed from goes down by 1.

Borrow 1
1 1 0 0 (12)
− 1 0 1 0 (10)
---------
0 0 1 0 (2)

Here the second column from the right needs 0 − 1, so it borrows from the third column, giving 10 − 1 = 1. The third column lent its 1, so it now has 0 − 0 = 0. If the column to the left is also 0, the borrow passes further left, turning each 0 it crosses into 1, which is why 10000 − 1 = 1111.

Example Calculations

BinaryDecimalBorrows
1100 − 1010 = 1012 − 10 = 21
1011 − 110 = 10111 − 6 = 51
101101 − 11011 = 1001045 − 27 = 182
10000 − 1 = 111116 − 1 = 154
1010 − 1100 = −1010 − 12 = −21

Negative Results

If the subtrahend is larger, swap the numbers, subtract as usual and put a minus sign in front of the answer: 1010 − 1100 = −(1100 − 1010) = −10. This sign-and-size form is how people write negative binary numbers. Computers instead store them in two’s complement, where −2 in 8 bits is 1111 1110. The calculator shows both, and warns when a result is too big for the chosen bit width.

Two’s Complement Subtraction

Inside a computer, subtraction is done by adding. To work out A − B: flip every bit of B (one’s complement), add 1 (two’s complement), add that to A and drop any carry out of the top bit.

12 − 10 in 8 bits:
B = 0000 1010
NOT B = 1111 0101
NOT B + 1 = 1111 0110
A + that = 0000 1100 + 1111 0110 = 1 0000 0010
Drop the carry → 0000 0010 = 2

If there is no carry to drop, the answer is negative and is already in two’s complement: 10 − 12 gives 0000 1010 + 1111 0100 = 1111 1110 = −2. To add binary numbers instead, use the Binary Addition Calculator.

Key Terms

Minuend
The number you subtract from (the first number).
Subtrahend
The number being taken away (the second number).
Difference
The result of the subtraction.
Borrow
Taking 1 from the next column to the left, worth 2 in the current column.
Two’s complement
The usual way computers store negative numbers: flip the bits and add 1.

How to Use the Binary Subtraction Calculator

  1. Enter the minuend. Type the binary number you are subtracting from in the “Minuend (binary)” box, for example 1100. Spaces, underscores and a 0b prefix are ignored. Pressing Enter moves you to the next box.
  2. Enter the subtrahend. Type the binary number to take away in the “Subtrahend (binary)” box, for example 1010. It can be larger than the minuend; the result is then negative.
  3. Set the bit width. Use the 8, 16, 32 or 64 chips, or type any width from 1 to 64. The width sets how many columns are shown and the size of the two’s complement result.
  4. Read the difference. The difference appears as soon as both numbers are filled, with the working in decimal underneath (for example 1100 − 1010 = 10, 12 − 10 = 2). Below it, the column subtraction shows every borrow, and a table gives the result in binary, decimal, two’s complement and hexadecimal.
  5. Copy the result. Press Copy to copy the binary difference. Press Clear or Esc to start again.

Example: enter 10000 and 1 and the difference is 1111 (16 − 1 = 15), with four borrows marked in a row.

Who Can Use This Calculator?

StudentsChecking computer science and digital logic homework step by step
TeachersShowing the borrow method and two’s complement in class
ProgrammersVerifying binary arithmetic and negative numbers in low-level code
Electronics HobbyistsChecking subtractor circuits and register values

Frequently Asked Questions (FAQs)

How do you subtract binary numbers?

Line the numbers up on the right and subtract column by column, starting from the right, just like decimal subtraction. Use the four rules 0 − 0 = 0, 1 − 0 = 1, 1 − 1 = 0, and 0 − 1 = 1 with a borrow from the next column to the left. For example, 1100 − 1010 = 0010, which is 12 − 10 = 2.

How does borrowing work in binary subtraction?

When a column needs 0 − 1, it borrows 1 from the column to its left. In binary that borrowed 1 is worth 2 in the current column, so 0 − 1 becomes 10 − 1 = 1. The column you borrowed from is reduced by 1. If that column is also 0, it borrows from further left, which is why 10000 − 1 = 1111 needs four borrows in a row.

What is 1 − 1 and 0 − 1 in binary?

1 − 1 = 0, the same as in decimal. 0 − 1 cannot be done in a single column, so you borrow: the 0 becomes 10 (two), and 10 − 1 = 1, with a borrow of 1 taken from the next column to the left.

What happens when the subtrahend is bigger than the minuend?

The result is negative. By hand, subtract the smaller number from the larger and put a minus sign in front: 1010 − 1100 = −(1100 − 1010) = −10, which is 10 − 12 = −2. A computer stores that answer in two’s complement instead: −2 in 8 bits is 1111 1110. The calculator shows both.

How do you subtract binary numbers using two’s complement?

Flip every bit of the subtrahend, add 1, then add the result to the minuend and drop any carry out of the top bit. For 12 − 10 in 8 bits: 0000 1010 flips to 1111 0101, plus 1 gives 1111 0110, and 0000 1100 + 1111 0110 = 1 0000 0010. Dropping the carry leaves 0000 0010 = 2. Computers subtract this way because it reuses the adding circuit.

How do you subtract using one’s complement?

Flip every bit of the subtrahend and add it to the minuend. If there is a carry out of the top bit, add it back to the result (the end-around carry). For 12 − 10 in 8 bits: 0000 1100 + 1111 0101 = 1 0000 0001, and adding the carry back gives 0000 0010 = 2. Two’s complement is more common because it avoids that extra step.

How do you check a binary subtraction?

Add the difference back to the subtrahend; you should get the minuend. For 1100 − 1010 = 10: 1010 + 10 = 1100. Or convert everything to decimal: 1100 = 12, 1010 = 10 and 12 − 10 = 2 = 10 in binary. The calculator shows the decimal working under every result.

What does the bit width change?

The width sets how many columns are shown and how many bits the two’s complement answer uses. The difference itself does not change: 1100 − 1010 = 10 at any width. A negative difference needs enough bits to store its sign; in 8 bits, two’s complement holds −128 to 127.

Is the Binary Subtraction Calculator free?

Yes. It is completely free, needs no sign-up, and can be used as many times as you like.

Try our Binary Subtraction Calculator to subtract any two binary numbers instantly.