Maths

Binary Calculator

Add, subtract, multiply, divide, AND, OR or XOR binary numbers exactly, with the answer in every base.

By Nitin Raturi · Last reviewed

Binary numbers

How to use the Binary Calculator

Add, subtract, multiply, divide or compare binary numbers, and see the answer in every base.

  1. Type the first binary number.
  2. Choose the operation.
  3. Type the second binary number.
  4. Read the answer in binary, octal, decimal and hexadecimal.

Good to know

  • Results are exact, however long the numbers are.
  • Use the hex calculator for base 16 input.

Whole numbers, exact to any size. Your numbers stay in this browser.

First binary number

A whole number written with 0s and 1s.

How to fill it in

  • Type up to 128 digits, such as 1011 or 0b1011.
  • Spaces or underscores between groups are ignored; a minus sign is allowed.

Example

100 in decimal is 1100100 in binary.

Operation

What to do with the two numbers.

How to fill it in

  • Add, subtract, multiply, or divide (whole-number part and remainder).
  • AND, OR and XOR compare the numbers bit by bit.

Example

1100 AND 1010 = 1000; 1100 XOR 1010 = 110; 1101 ÷ 11 = 100 remainder 1.

Second binary number

The other whole number, in binary.

How to fill it in

  • Type 0s and 1s; for division it cannot be 0.

Example

1001 + 11011 = 100100 (36 in decimal).

1001 + 11011

100100

In decimal: 36.

Binary
100100
Octal
44
Decimal
36
Hexadecimal
24

Whole numbers only. Division keeps the whole-number part and shows the remainder. AND, OR and XOR work bit by bit on numbers of zero or more.

How this calculator works

  1. Step 1Place values…8 4 2 1Each place is worth twice the one to its right.
  2. Step 2CalculateExactThe numbers are added, multiplied or compared exactly.
  3. Step 3Write backEvery baseThe answer is shown in binary, octal, decimal and hex.

Binary uses only two digits, 0 and 1. Reading from the right, the places are worth 1, 2, 4, 8 and so on. To write a decimal number in binary, divide by 2 repeatedly and read the remainders from last to first: 100 becomes 1100100.

Worked example: 1001 + 11011

Adding in base 2
Rule
1 + 1 = 10: write 0, carry 1
  1. 10018 + 19
  2. 1101116 + 8 + 2 + 127
  3. Sum in binary100100
  4. Sum in decimal9 + 2736

This is OpenStax Contemporary Mathematics Example 4.33.

Arithmetic and bitwise operations

  • Arithmetic1101 ÷ 11 = 100 r 1Add, subtract, multiply and whole-number divide.
  • BitwiseAND 1000 · XOR 110Compare 1100 and 1010 one bit at a time.

Read the result

The headline is the answer in binary; the table repeats it in octal, decimal and hexadecimal.

Division gives the whole-number quotient and the remainder, as when dividing by hand.

Assumptions and limits

  • Whole numbersNo binary fractions or floating point.
  • Any sizeExact up to 128 binary digits in each input.
  • Sign, not two’s complementNegative numbers are written with a minus sign.

Binary and hexadecimal are two ways of writing the same bits.

For base-16 arithmetic, use the hex calculator. Subnet masks are binary arithmetic on addresses, which the IP subnet calculator works out, and the chmod calculator turns permission bits into octal.

Common mistakes

  • Mistake: Reading 10 in binary as ten.

    Instead: Binary 10 is two; check the decimal line.

  • Mistake: Forgetting the carry: 1 + 1 = 2.

    Instead: In binary 1 + 1 = 10: write 0 and carry 1.

Checking the method

Every golden case is rechecked with Python’s own base conversion, and two OpenStax examples are reproduced.

An independent script reads each number with Python’s int(text, 2) and writes results with its built-in formatting.

Read how we test our calculators, or browse more maths calculators.

Frequently asked questions

How do I add binary numbers?

Add column by column; 1 + 1 = 10, so write 0 and carry 1. 1001 + 11011 = 100100.

How do I convert decimal to binary?

Divide by 2 repeatedly and read the remainders from last to first: 100 is 1100100.

What does binary AND do?

It keeps a 1 only where both numbers have a 1. 1100 AND 1010 = 1000.

How does binary division work here?

It gives the whole-number quotient and the remainder: 1101 ÷ 11 = 100 remainder 1.

How long can the numbers be?

Up to 128 binary digits each; the arithmetic is exact at any length.

Sources and methodology

The formulas are standard time-value-of-money results. We check every figure against golden values worked out independently, by closed form and by month-by-month simulation; see the methodology.

Written and maintained by Nitin Raturi, a software engineer (about the author). Last reviewed 3 Nov 2026; next review due by . Found an error? Tell us.

Changelog

  • : Initial release.