Binary Subtraction Calculator
Subtract two binary numbers quickly. Enter values, get the difference instantly, and copy the result for coding practice and quick checks.
Binary Subtraction Calculator
Result will appear here...
What the binary subtraction calculator does
This subtracts one binary number from another and shows the difference in both binary and decimal. Enter the two numbers, press the button, and read off the result.
Subtracting in binary follows the same column method as ordinary subtraction, borrowing from the next column when you need to. The borrow just behaves a little differently because each column is worth twice the one to its right.
How to use it
- Choose a bit size. This sets how wide your numbers are, with 8 as the default.
- Enter the two binary numbers. The first is the one you subtract from; the second is what you take away. Use only 0s and 1s.
- Press Calculate. The difference appears as both a binary result and a decimal result.
Press Reset to clear the inputs.
The rules of subtracting bits
You subtract column by column from the right, exactly like ordinary subtraction. Three of the four cases are easy:
- 0 - 0 = 0
- 1 - 0 = 1
- 1 - 1 = 0
- 0 - 1 needs a borrow
That last case is the one to watch. You cannot take 1 from 0, so you borrow from the column to the left. In decimal a borrow is worth ten; in binary it is worth two, because each column is twice the value of its neighbour. So the borrowed 0 becomes 2, and 2 - 1 = 1. You write 1 in that column and remember that the column you borrowed from is now one less.
A worked example with real numbers
Let us work out 1010 minus 0011. Go right to left.
- Rightmost column: 0 - 1. Borrow from the left, making it 2 - 1 = 1. Write 1, and the next column now owes a borrow.
- Next column: it holds 1, but it owes a borrow, so it is really 0, and 0 - 1 borrows again to give 1. Write 1, and the next column owes a borrow.
- Next column: it holds 0, owes a borrow so it is really minus 1, borrow again to get 1. Write 1, next column owes a borrow.
- Leftmost column: it holds 1, owes a borrow so it is 0, and 0 - 0 = 0. Write 0.
Reading the result gives 0111. To check it, 1010 is 10 and 0011 is 3, and 10 - 3 is 7, which is exactly what 0111 comes to.
When the second number is larger
The plain borrow method works cleanly as long as the first number is at least as big as the second, so the answer does not go below zero. If you subtract a larger number from a smaller one, the result is negative, and the calculator handles that in two ways at once. The decimal result shows the true negative value, so you can read it directly. The binary result shows the same answer in two's complement, the standard way computers store negative numbers, written to fit the bit size you chose. A negative result in two's complement begins with a leading 1, which is the marker that the value is below zero.
This is also why the bit size matters here. The binary answer is written across exactly that many bits, so a negative value fills the high bits with 1s out to that width. If you want to see how a two's complement pattern is built, by inverting the bits and adding one, the dedicated two's complement calculator walks through it step by step.
Questions people ask
How does binary subtraction work?
You subtract column by column from the right, borrowing when a column cannot cover the digit below it. A borrow in binary is worth 2, so a borrowed 0 becomes 2, and 2 - 1 = 1.
What do you do for 0 - 1?
You borrow from the next column to the left. That makes the 0 worth 2, so the column becomes 2 - 1 = 1, and the column you borrowed from drops by one.
What if the answer would be negative?
If the second number is larger, the difference is negative. The decimal result shows the true negative value, and the binary result shows it in two's complement, the standard way negatives are stored in bits, written to your chosen bit size with a leading 1.
Why is a binary borrow worth 2 and not 10?
Because each column in binary is worth twice the column to its right, where in decimal each column is worth ten times the next. So a borrow carries a value of 2 across.
References
- Weisstein, Eric W. "Binary." From MathWorld, A Wolfram Resource. https://mathworld.wolfram.com/Binary.html
Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.