Binary Calculator: Add, Subtract, Multiply and Divide

Type two binary numbers, pick an operation and see the answer in binary with the same sum in decimal next to it, plus the carries written out column by column.

MathFreeNo sign-upWorks on phones
What to do
Operation
––

This tool runs in your browser. Nothing you type is uploaded or saved, and there is nothing to install or sign up for.

What you can do with this binary calculator

Binary is the base-2 number system: every digit is a 0 or a 1, and each place is worth twice the place to its right. This page does the four arithmetic operations on two binary numbers, plus the three bitwise operations AND, OR and XOR. Every answer comes with the same calculation in everyday decimal numbers, so you can confirm it with arithmetic you already trust.

A second mode converts a whole number between binary, octal, decimal and hexadecimal. If converting is all you need, including text to binary, the binary converter is built for that job. This page is for the sums.

How to run a calculation

  1. Keep What to do on Binary arithmetic.
  2. Type the first number into Binary number A and the second into Binary number B. Spaces between groups of digits are fine.
  3. Tap an Operation: A + B, A − B, A × B, A ÷ B, AND, OR or XOR.
  4. The navy panel shows the answer in binary. The lines under it give the decimal check, the answer in hexadecimal and octal, and the number of bits.
  5. For addition, multiplication and the bitwise operations, a table shows the working. Copy result copies the sum as one line, and Reset returns to 1011 and 110.

Worked example: 1011 + 110

The page opens with A = 1011 (eleven) and B = 110 (six). Line the numbers up on the right and add one column at a time, carrying a 1 whenever a column totals two or three.

ColumnDigit of ADigit of BCarry inSum digitCarry out
110010
211001
301101
410101
500110

Reading the sum digits from the bottom row up gives 10001. In decimal that is 11 + 6 = 17, and 10001 is indeed 16 + 1.

The other operations on the same pair of numbers:

  • 1011 − 110 = 101 (11 − 6 = 5)
  • 1011 × 110 = 1000010 (11 × 6 = 66)
  • 1011 ÷ 110 = 1 remainder 101 (11 ÷ 6 = 1 remainder 5)
  • 1011 AND 110 = 10, 1011 OR 110 = 1111, 1011 XOR 110 = 1101

The rules behind each operation

Addition and subtraction

Binary addition has only four facts to remember: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1). Subtraction works the other way around with borrowing: when you need to take 1 from 0, you borrow from the next column, which turns the 0 into 10 (two).

Multiplication and division

Multiplying by a binary digit is easy because the digit is either 0 or 1. For each 1 in B, write down A shifted left by that digit’s position, then add the shifted copies. For 1011 × 110 the copies are 10110 (22) and 101100 (44), which add to 1000010 (66). Division is long division in base 2: the answer here is a whole-number quotient and a remainder, never a binary fraction. For a decimal walk-through of the same method, see the long division calculator, and for remainders alone there is the modulo calculator.

AND, OR and XOR

These compare the two numbers one column at a time, with no carrying at all. The shorter number is padded with zeros on the left.

A digitB digitANDORXOR
00000
01011
10011
11110

AND gives 1 only where both digits are 1. OR gives 1 where at least one is. XOR gives 1 where the two digits differ.

Converting between bases on the same page

Choose Convert between bases, type a number, and set From base and To base. With the starting value 255 going from decimal to binary, the answer is 11111111. The detail lines show all four bases at once (octal 377, hexadecimal FF) and, for numbers up to 16 bits, the place values of the 1 digits: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. That expansion is the same idea as the place value calculator uses for decimal numbers, with powers of 2 in place of powers of 10.

Limits and mistakes to avoid

  • Whole numbers only. There is no binary point and no minus sign in the inputs.
  • Negative answers. If B is larger than A in a subtraction, the answer is shown with a minus sign. It is not converted to two’s complement, because that depends on a word size you would have to choose.
  • Size. Inputs and answers can be up to 53 bits long, which is 9,007,199,254,740,991 in decimal. Beyond that a browser cannot count exactly, so the tool stops and says so.
  • Misaligned columns. On paper, line numbers up on the right, not the left. Most wrong answers in binary addition come from this or from a forgotten carry.
  • Reading 10 as ten. In binary, 10 means two. Saying the digits one by one, one-zero, helps avoid the slip.

Ideas for computer science lessons

Have students add two 4-bit numbers on paper, fill in their own carry row, and then compare it with the carry columns in the table. Mismatched carries show exactly where a method went wrong. For bitwise practice, ask the class to predict the AND of two numbers before tapping the button, and then explain why the answer can never be larger than the smaller input.

Hexadecimal is the usual next step, since each hex digit stands for a group of four bits, and the hex calculator does the same arithmetic in base 16. You can find both with the other math calculators, or browse the whole collection of free online tools for school.

Frequently asked questions

How do you add binary numbers?

Line the numbers up on the right and add each column, carrying 1 to the next column whenever the total is 2 or 3. For example, 1011 + 110 = 10001, which is 11 + 6 = 17 in decimal.

What is 1 + 1 in binary?

It is 10, read as one-zero. The total is two, which does not fit in one binary digit, so you write 0 and carry 1 into the next column.

How do you multiply binary numbers?

For every 1 in the second number, write the first number shifted left by that digit’s position, then add the shifted copies. 1011 x 110 gives 10110 + 101100 = 1000010, which is 66 in decimal.

How does binary division work here?

The calculator gives a whole-number quotient and a remainder, like long division. 1011 divided by 110 is 1 with remainder 101, which matches 11 divided by 6 = 1 remainder 5.

What is the difference between AND, OR and XOR?

They compare two numbers one digit at a time. AND gives 1 only when both digits are 1, OR gives 1 when at least one digit is 1, and XOR gives 1 when the digits are different. For 1011 and 110 the results are 10, 1111 and 1101.

What is 255 in binary?

255 in decimal is 11111111 in binary, eight 1s in a row. It is also 377 in octal and FF in hexadecimal.

Related tools

Browse all free tools →