Binary Calculator

Do arithmetic on two binary numbers and see the answer in three bases.

How it works

Binary arithmetic follows the same rules as ordinary arithmetic, with only two digits to remember.

Addition. 0 + 0 is 0. 0 + 1 is 1. 1 + 1 is 10, so you write 0 and carry 1. 1 + 1 + 1 is 11, so you write 1 and carry 1. Work from the right, column by column, as you would in decimal.

Subtraction. When you need to take 1 from 0, borrow from the next column. The borrowed 1 is worth 2 in the column you are working on.

Multiplication. Each line is either a copy of the top number or a row of zeros, shifted one place left each time. Add the lines.

AND, OR and XOR compare the two numbers bit by bit. AND gives 1 only where both have a 1. OR gives 1 where either has a 1. XOR gives 1 where exactly one has a 1.

Division here is whole number division, with the remainder shown separately.

Worked example

1011 + 110: from the right, 1 + 0 = 1. 1 + 1 = 10, write 0 carry 1. 0 + 1 + 1 = 10, write 0 carry 1. 1 + 1 = 10. Answer: 10001, which is 11 + 6 = 17.

Powers of 2

Position from rightPowerValue
0201
1212
2224
3238
42416
52532
62664
727128
828256
929512
102101,024
112112,048
122124,096
132138,192
1421416,384
1521532,768
1621665,536

Common questions

What is 1 + 1 in binary?

10. It means one two and no ones.

How are negative results shown?

With a minus sign in front. Computers usually store negatives in two's complement form, which depends on a fixed number of bits.

Related tools