Binary Calculator

Enter two binary numbers and an operation to get the result in binary, decimal, hex and octal.

Calculator
Result

What this tool does

Binary numbers use only 0 and 1. 1011 + 110 is 11 + 6 = 17, which is 10001 in binary. Enter two binary numbers, choose add, subtract, multiply, divide, AND, OR or XOR, and read the answer in binary, decimal, hexadecimal and octal.

Parses the two binary inputs exactly, using arbitrary-precision integers.

Performs the chosen operation and shows the result in four number bases.

How to use it

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

Why use this calculator

Adds, subtracts, multiplies and divides binary numbers, and applies AND, OR and XOR, giving the answer in binary, decimal, hexadecimal and octal. Binary arithmetic is a staple of computer science courses, and carrying bits by hand is error-prone. A calculator lets you check a worked answer or explore how bitwise operations behave.

Why we built it

We built the binary calculator to do arithmetic and bitwise operations on arbitrarily long binary numbers and show decimal, hex and octal. Convert bases with the number base converter and look up codes in the ASCII table.

Handy alongside this: the Chmod Calculator, the Long Division Calculator and the Arithmetic and Geometric Sequence Calculator.

Who this tool is for

  • Computer science students
  • Programmers checking bit operations
  • Electronics learners

When to use it

  • Computer science and digital logic homework.
  • Checking binary addition or subtraction.
  • Understanding masks and flags.
  • Converting a result to hex.

How it works

Each input is read as a base-2 integer. Addition, subtraction and multiplication follow the usual rules; division is whole-number division with a remainder. AND, OR and XOR compare the numbers bit by bit: AND keeps bits set in both, OR keeps bits set in either, XOR keeps bits that differ.

Examples: 1011 + 110 = 10001 (11 + 6 = 17). 1010 − 11 = 111. 101 × 11 = 1111. 1101 ÷ 101 = 10 remainder 11. 1100 AND 1010 = 1000. 1100 XOR 1010 = 110.

A worked example

These are the values the calculator opens with, so you can see exactly what it does with them. Change any value on the page and the result updates; the figures below come from the same calculation.

Example inputs for the binary calculator
InputValue
First binary number1011
OperationAdd (+)
Second binary number110

With those inputs, the calculator returns:

  • Result (binary): 10001
  • Decimal: 17
  • Hexadecimal: 11
  • Octal: 21
  • First number in decimal: 11
  • Second number in decimal: 6

What you give it, and what you get back

Input and output of Binary Calculator
ItemDetails
Binary numbersOnly 0 and 1, up to 256 digits, optional 0b prefix and minus sign.
OperationAdd, subtract, multiply, divide, AND, OR or XOR.
OutputResult in binary, decimal, hexadecimal and octal, and the remainder for division.

Issues you may run into

Common problems with Binary Calculator
What you seeWhy it happensWhat to do
Only 0 and 1 are allowedThe input contains other digits.Check for typos or use the number base converter.
Bitwise on a negative numberNot supported.Use non-negative numbers.
Negative results show a minus signTwo's complement is not used.This is the signed value.

Assumptions and limitations

Frequently asked questions

How do I add binary numbers?

Add column by column, carrying 1 when 1 + 1 = 10. Or enter them above.

What is binary subtraction?

Subtracting bit by bit, borrowing from the next column when needed.

What do AND, OR and XOR do?

They compare bits: AND needs both set, OR needs either, XOR needs exactly one.

How do I convert binary to decimal?

Add the powers of two for each 1 bit. The result row shows it.

Is there a size limit?

Up to 256 binary digits.

Is my information sent anywhere?

No. The calculation runs in your browser and nothing leaves the page.

Sources and accuracy

Arithmetic follows base-2 positional notation, and results are converted between binary, decimal, hexadecimal and octal using standard radix conversion. Numeral system and floating-point conventions are covered by computer arithmetic standards published by the IEEE and in NIST reference material.

Figures last checked against the source on . Standards and rates can change — if you are relying on this for something that matters, confirm against the source above. Think a figure is wrong or out of date? Send a correction.