How to Use the Calculator?
To use the calculator, first enter a binary number into Value A and a second one into Value B. Then, select whether you wish to add, subtract, multiply, or divide them. As you type, the answer will automatically appear in the Result box. For your convenience, the same answer will also be displayed in decimal, binary, and octal formats.
Binary Math
When we do math in everyday life, we usually use the decimal system, which has ten digits: $0,1,2,3,4,5,6,7,8,9$ . Computers, however, use the binary system, which has only two digits: $0$ and $1$ .
At first, binary can look strange, but it follows the same logic as ordinary math. The only real difference is that instead of grouping by powers of $10$, binary groups by powers of $2$.
So, in this tutorial, let’s learn how to perform binary addition, subtraction, multiplication, and division, one by one.
Understanding place value in binary
In decimal, the number $472$ means:
$$4 \times 10^2 + 7 \times 10^1 + 2 \times 10^0$$
In binary, the number $1011_2$ means:
$$1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0$$
Now let us calculate that value:
$$1 \times 8 + 0 \times 4 + 1 \times 2 + 1 \times 1 = 11$$
So $1011_2$ is equal to $11_{10}$.
This place value idea is the key to everything in binary math.
The first few binary place values are:
$$1, 2, 4, 8, 16, 32, 64,\ldots$$
That means:
$$\begin{aligned} 1 &= 1 \\ 10_2 &= 2 \\ 100_2 &= 4 \\ 1000_2 &= 8 \end{aligned}$$
Once you understand that each place is a power of $2$, binary arithmetic becomes much easier.
Binary addition
Binary addition is actually simpler than decimal addition because there are only four possible combinations when adding one digit to another.
Here are the basic binary addition facts:
$$\begin{aligned} 0+0&=0 \\ 0+1&=1 \\ 1+0&=1 \\ 1+1&=10 \end{aligned}$$
The last one is the most important. In binary, $1+1$ does not equal $2$ written as a single digit, because $2$ is written as $10_2$ in binary. So we write $0$ and carry $1$ to the next column.
There is also one more useful fact when a carry is involved:
$$1+1+1=11$$
That means write $1$ and carry $1$.
Let us now do binary addition the same way you do column addition in decimal.
Example 1
We write the numbers one under the other:
$$\begin{aligned}& \phantom{0}1011_2 \\ + & \phantom{1} 0110_2 \\ \hline \end{aligned}$$
Now add from right to left.
In the rightmost column, $1+0=1$.
In the next column, $1+1=10$. So we write down $0$ and carry $1$.
In the third column, $0+1=1$, and then add the carry $1$, so $0+1+1=10$. Write $0$ and carry $1$.
In the fourth column, $1+0=1$, and then add the carry $1$, so $1+0+1=10$. Write $0$ and carry $1$.
Now place the final carry at the front.
$$\begin{aligned}& \phantom{0}1011_2 \\ + & \phantom{1} 0110_2 \\ \hline & 10001_2 \end{aligned}$$
Let us check in decimal:
$$\begin{aligned}1011_2 &= 11 \\ 0110_2 &= 6 \end{aligned}$$
$$11 + 6 = 17$$
And $10001_2$ really is $17$, so our answer is correct.
Example 2
Let us:
$$\begin{aligned}& \phantom{0}111_2 \\ + & \phantom{1} 101_2 \\ \hline \end{aligned}$$
From right to left:
Rightmost column: $1+1=10$. Write $0$, carry $1$.
Middle column: $1+0+1=10$. Write $0$, carry $1$.
Left column: $1+1+1=11$. Write $1$, carry $1$.
Bring down the carry.
$$\begin{aligned}& \phantom{0}111_2 \\ + & \phantom{1} 101_2 \\ \hline & 1100_2 \end{aligned}$$
Check in decimal:
$$\begin{aligned}111_2 &= 7 \\ 101_2 &= 5 \end{aligned}$$
$$7 + 5 = 12$$
And $1100_2 = 12$, so again the answer is correct.
Binary subtraction
Binary subtraction also has simple rules. These are the basic facts:
$$0-0=0 \\ 1-0=1 \\ 1-1=0$$
The tricky one is:
$$0-1$$
You cannot subtract $1$ from $0$ unless you borrow from the next column, just like in decimal subtraction.
But in binary, borrowing works a little differently because each place is worth $2$ times the place to its right. So when you borrow $1$ from the next column, that borrowed $1$ is worth $10_2$ in the current column, which is decimal $2$.
So in binary:
$$10_2 – 1_2 = 1_2$$
That is why when we borrow, the $0$ becomes $10_2$.
Example 1
Let us:
$$\begin{aligned} & \phantom{0}1010_2 \\ – & \phantom{1} 0011_2 \\ \hline \end{aligned}$$
Let us do it column by column from right to left.
In the rightmost column, we have $0-1$. We cannot do that, so we borrow from the next column.
But the next column is also $1$ in the original number. Borrowing from it turns that $1$ into $0$, and gives $10_2$ to the rightmost column.
So now the rightmost column becomes:
$$10_2 – 1_2 = 1_2$$
Write $1$.
Now look at the next column. After borrowing, that column became $0$. We need $0-1$, so we borrow again from the next column.
But the next column is $0$, so we must move one more step left and borrow from the $1$ there. That $1$ becomes $0$, the $0$ next to it becomes $10_2$, then from that we borrow $1$ to the next column. After that chain of borrowing, the second column becomes $10_2$.
Then:
$$10_2 – 1_2 = 1_2$$
Write $1$.
In the third column, after the borrowing chain, it becomes $1-0=1$.
In the fourth column, it becomes $0-0=0$.
So the result is:
$$\begin{aligned} & \phantom{0} 1010_2 \\ – & \phantom{0} 0011_2 \\ \hline & \phantom{0} 0111_2 \end{aligned}$$
Check in decimal:
$$\begin{aligned} 1010_2 &= 10 \\ 0011_2 &= 3 \end{aligned}$$
$$10 – 3 = 7$$
And $111_2 = 7$.
Example 2
Let us:
$$\begin{aligned} & \phantom{0}1000_2 \\ – & \phantom{1} 0101_2 \\ \hline \end{aligned}$$
Work from right to left.
Rightmost column: $0-1$, so borrow.
Since there are zeros in between, we borrow from the leftmost $1$ and pass it through.
After borrowing, the rightmost column becomes $10_2 – 1_2 = 1_2$.
The next column becomes $1-0=1$.
The next column becomes $1-1=0$.
The leftmost column becomes $0-0=0$.
So:
$$\begin{aligned} & \phantom{0}1000_2 \\ – & \phantom{1} 0101_2 \\ \hline & \phantom{0} 0011_2 \end{aligned}$$
Check in decimal:
$$\begin{aligned}1000_2 &= 8 \\ 0101_2 &= 5 \end{aligned}$$
And $11_2 = 3$.
Binary multiplication
Binary multiplication is often easier than decimal multiplication because you only multiply by $0$ or $1$.
Here are the basic facts:
$$0 \times 0 = 0 \\ 0 \times 1 = 0 \\ 1 \times 0 = 0 \\ 1 \times 1 = 1$$
That means binary multiplication uses the same long multiplication method you already know, but each step is much simpler.
When multiplying by $0$, the result is all zeros.
When multiplying by $1$, the result is just the original number.
Example 1
Let us:
$$\begin{aligned} & \phantom{0}101_2 \\ \times & \phantom{00} 11_2 \\ \hline \end{aligned}$$
Start with the rightmost digit of the bottom number.
The rightmost digit is $1$, so we copy the top number: $101$
Now move to the next digit on the left. It is also $1$, so again copy $101$, but shift it one place left: $1010$
Now add the partial products:
$$\begin{aligned} & \phantom{0}0101_2 \\ + & \phantom{0} 1010_2 \\ \hline & \phantom{0} 1111_2 \end{aligned}$$
So:
$$\begin{aligned} & \phantom{0}101_2 \\ \times & \phantom{00} 11_2 \\ \hline & 1111_2 \end{aligned}$$
Check in decimal:
$$\begin{aligned}101_2 &= 5 \\ 11_2 &= 3 \end{aligned}$$
$$5 \times 3 = 15$$
And $1111_2 = 15$.
Example 2
Let us:
$$\begin{aligned} & \phantom{0}110_2 \\ \times & \phantom{0} 101_2 \\ \hline \end{aligned}$$
Write the partial products.
The rightmost digit of $101_2$ is $1$, so copy $110$.
The middle digit is $0$, so the partial product is $000$, shifted one place: $0000$
The leftmost digit is $1$, so copy $110$ and shift it two places: $11000$
Now add:
$$\begin{aligned} & \phantom{0}00110_2 \\ & \phantom{0}00000_2 \\ + & \phantom{0} 11000_2 \\ \hline & \phantom{0} 11110_2 \end{aligned}$$
So:
$$\begin{aligned} & \phantom{00}110_2 \\ \times & \phantom{00} 101_2 \\ \hline & 11110_2 \end{aligned}$$
Check in decimal:
$$110_2 = 6 \\ 101_2 = 5$$
$$6 \times 5 = 30$$
And $11110_2 = 30$.
Binary division
Binary division works just like long division in decimal. The good news is that the multiplication facts are very simple, so the guessing part is easier.
When dividing in binary, you repeatedly ask, “How many times does the divisor fit into the current part of the dividend?” Since digits are only $0$ and $1$, the answer at each step is usually just $0$ or $1$.
Example 1
Let us:
$$\begin{aligned} & \phantom{0}1100_2 \\ \div & \phantom{000} 10_2 \\ \hline \end{aligned}$$
In decimal, this is $12 \div 2$, so we expect $6$, which is $110_2$. But let us do it in binary.
We check how many times $10_2$ goes into the first part of the dividend.
The first digit is $1$, which is smaller than $10_2$, so we look at the first two digits: $11_2$.
$10_2$ fits into $11_2$ one time, so write $1$ in the quotient.
Subtract:
$$11_2 – 10_2 = 1_2$$
Bring down the next digit, which is $0$, making $10_2$.
$10_2$ fits into $10_2$ one time, so write $1$.
Subtract:
$$10_2 – 10_2 = 0_2$$
Bring down the final digit, which is $0$.
Now we have $0$, and $10_2$ goes into $0$ zero times, so write $0$.
So the quotient is:
$$\begin{aligned} & 1100_2 \\ \div & \phantom{00} 10_2 \\ \hline & \phantom{0} 110_2 \end{aligned}$$
Example 2
Let us:
$$\begin{aligned} & \phantom{0}1111_2 \\ \div & \phantom{000} 11_2 \\ \hline \end{aligned}$$
In decimal, this is $15 \div 3 = 5$, so we expect $101_2$.
Now let us divide.
Look at the first two digits: $11_2$.
$11_2$ goes into $11_2$ exactly one time, so write $1$.
Subtract:
$$11_2 – 11_2 = 0_2$$
Bring down the next digit, which is $1$. Now we have $1_2$.
$11_2$ does not fit into $1_2$, so write $0$ in the quotient.
Bring down the next digit, giving $11_2$.
Now $11_2$ fits one time, so write $1$.
Subtract:
$$11_2 – 11_2 = 0_2$$
So:
$$\begin{aligned} & 1111_2 \\ \div & \phantom{00} 11_2 \\ \hline & \phantom{0} 101_2 \end{aligned}$$
And that matches the decimal check.
Example 3
Let us:
$$\begin{aligned} & \phantom{0}1011_2 \\ \div & \phantom{000} 10_2 \\ \hline \end{aligned}$$
In decimal this is $11 \div 2$, which gives $5$ remainder $1$. In binary, $5$ is $101_2$, so we expect quotient $101_2$ remainder $1_2$.
Now do the division.
Take the first two digits: $10_2$.
$10_2$ goes into $10_2$ one time, so write $1$.
Subtract:
$$10_2 – 10_2 = 0_2$$
Bring down the next digit $1$.
Now we have $1_2$.
$10_2$ does not fit into $1_2$, so write $0$.
Bring down the last digit $1$, making $11_2$.
$10_2$ fits into $11_2$ one time, so write $1$.
Subtract:
$$11_2 – 10_2 = 1_2$$
So the answer is:
$$\begin{aligned} & \phantom{0}1011_2 \\ \div & \phantom{000} 10_2 \\ \hline & \phantom{00} 101_2 \text{ remainder } 1_2 \end{aligned}$$
A very useful shortcut: multiplying and dividing by $10_2$
In decimal, multiplying by $10$ adds a zero to the end. In binary, multiplying by $10_2$ does something similar: it shifts the number left by one place.
For example:
$$101_2 \times 10_2 = 1010_2$$
This makes sense because:
$$101_2 = 5 \\ 1010_2 = 10$$
So multiplying by $10_2$ doubles the number.
Likewise, dividing by $10_2$ shifts the number right by one place, as long as it divides evenly.
For example:
$$1010_2 \div 10_2 = 101_2$$
This works because dividing by $10_2$ means dividing by $2$.
This shortcut is very helpful in binary math.
Final thoughts
Binary math may seem unfamiliar at first, but it is not really harder than decimal math. The same four operations are used, and the same ideas of carrying, borrowing, shifting, and long division still apply.
The main thing to remember is that binary uses powers of $2$ instead of powers of $10$. Once you get used to the basic rules such as $1+1=10_2$ and $10_2-1_2=1_2$, the patterns become clear.
A good way to practice is to first convert small binary numbers into decimal so you can check your work. That helps build confidence. After some practice, you will start to recognize binary patterns quickly and solve problems more easily.
Binary is important because it is the language of computers, digital circuits, and programming. So when you learn binary math, you are also learning one of the foundations of computer science.
