Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages

Free tool · Developer tools

Binary calculator

Type two binary numbers and pick an operation. 1011 plus 0111 is 10010, which is 11 + 7 = 18 in decimal. The page shows the carries, the answer in decimal and hex, and all four operations side by side.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Use only 0 and 1. A leading minus, 0b, spaces and low lines (_) are fine.
1011 + 111

1001018 in decimal

  • 11 + 7
  • 0x12
  • 5 bits
Decimal
18
Hex
0x12
Digits (bits)
5
Ones in the result
2
Working
carry  1111 
A       1011
+        111
       -----
result 10010
All four operations on A and B
OperationBinaryDecimal
Add (A + B)1001018
Subtract (A - B)1004
Multiply (A × B)100110177
Divide (A ÷ B)1 remainder 1001 remainder 4

How to use the Binary Calculator

  1. Type Binary number A and Binary number B using only 0 and 1.
  2. Choose the Operation: add, subtract, multiply or divide.
  3. Read the answer in binary, then the decimal and hex values and the written working below it.
  4. Use Swap A and B to turn A minus B into B minus A, then press Copy to take the result.

How do you add binary numbers?

Binary addition works like decimal addition with only two digits. Each column adds up the two bits and any carry from the column on its right. A column total of 0 or 1 is written down as it is. A total of 2 is written as 0 with a carry of 1, and a total of 3 is written as 1 with a carry of 1.

Take 1011 plus 0111. From the right, 1 + 1 gives 0 carry 1, then 1 + 1 + 1 gives 1 carry 1, then 0 + 1 + 1 gives 0 carry 1, then 1 + 0 + 1 gives 0 carry 1, and the last carry becomes the leading 1. The page draws the same steps under the answer, with the carries written above each column.

The five column cases of binary addition
ColumnWritten asDecimal
0 + 000
0 + 111
1 + 011
1 + 1102
1 + 1 + 1 (with a carry)113

How do you subtract, multiply and divide in binary?

Subtraction borrows the way decimal subtraction does: when a column needs a bigger digit, it takes 1 from the next column, which is worth 2 here. 1011 minus 0111 is 100. When the second number is bigger the answer is negative, so 101 minus 1011 is -110, and the working then shows the larger number minus the smaller.

Multiplication adds shifted copies of A, one for each 1 in B. B has three 1s, so the product is 1011 + 10110 + 101100, which sums to 1001101. In decimal that is 11 times 7, or 77.

Division gives a whole quotient and a remainder. 11 divided by 7 is 1 with remainder 100, and the page checks it by multiplying back: quotient times divisor plus remainder must give A. The quotient is cut toward zero, so -1011 divided by 111 gives -1 remainder -100, and the remainder keeps the sign of the first number.

All four operations on 1011 and 0111
OperationBinaryDecimal
Add (A + B)1001018
Subtract (A - B)1004
Multiply (A × B)100110177
Divide (A ÷ B)1 remainder 1001 remainder 4

How long can the binary numbers be?

Each number may have up to 512 digits. The page does the sums on whole numbers of any size, so nothing is rounded and nothing overflows. A product of two 70 digit numbers of all ones has 140 digits and the page shows every one of them. The column working appears for numbers up to 64 digits, because longer lines no longer fit a screen.

Numbers may start with a minus sign or 0b, and spaces or a low line can group the digits, so 1111_0000 is read as 240. Any other character is named in an error message. For bit operations such as AND, OR and shifts use the bitwise calculator, for another base use the number base converter, and for fixed width negatives the two's complement calculator.

How do I read the answer in decimal and hex?

Each binary digit has a place value that doubles with every step to the left of the last digit: 1, 2, 4, 8, 16 and on. 10010 has a 1 in the 16 place and in the 2 place, so it is 16 + 2 = 18. The page adds this sum for you in the decimal line under the answer.

Hex packs four bits into one digit. Split 10010 from the right into groups of four, which gives 1 0010, and read each group as a number from 0 to 15: 1 and 2 give 0x12. The same split is why a binary number of 8 digits is always two hex digits.

Use it with

Questions

What is 1 + 1 in binary?

It is 10, which is zero in the column and a carry of one into the next. In decimal that is 2.

How do I add two binary numbers?

Add column by column from the right and carry 1 whenever a column reaches 2. For 1011 + 0111 the result is 10010.

Can the binary calculator handle negative numbers?

Yes. Start a number with a minus sign. For example 101 minus 1011 gives -110. The sign is shown as a minus, not as two's complement.

What happens when I divide by zero?

The page shows a message and no answer, because division by zero has no result. Pick another operation and the table lists the divide row as undefined.

How do I convert the result to decimal?

The decimal and hex values appear under the answer. 10010 is 16 + 2, which is 18.

Is my input stored?

No. The numbers you type stay on this page, and no request is made with them.

The tool's results are computed in your browser by the code on this page; the explanations are checked against the tool's own output.