Developer / Numbers

Binary Calculator (Arithmetic and Bitwise, Binary and Hex)

Add, subtract, multiply, divide, and take the remainder of numbers in binary, octal, decimal, or hexadecimal, or apply AND, OR, XOR, and shifts, with the result in all four bases and negative results in two's complement.

Binary Calculator (Arithmetic and Bitwise, Binary and Hex): Numbers are read as exact integers of any size, so there is no overflow. 1011 + 110 in binary is 10001 (11 + 6 = 17); 1011 XOR 0110 is 1101. Division is integer division, as in most programming languages, and mod gives the remainder. A negative result is also shown in two's complement at 8, 16, 32, or 64 bits: −5 in 8 bits is 11111011. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Binary calculatorLocal processing

Runs entirely in your browser

Binary10001
Decimal17
Hexadecimal11
Octal21

Arithmetic and bitwise operations on whole numbers of any size, entered in binary, octal, decimal, or hexadecimal. Division discards the remainder, as integer division does in programming languages; mod gives the remainder. AND, OR, and XOR compare the bits one by one, and shifting left by n multiplies by 2ⁿ. Negative results are also shown in two's complement, the way computers store them.

Bitwise operations

AND keeps a bit only where both numbers have it (masking), OR where either has it (setting flags), and XOR where exactly one has it (toggling): 1100 AND 1010 = 1000, OR = 1110, XOR = 0110.

To convert a single number between bases, use binary to decimal or hex to decimal.

Number sizes

Programming languages store integers in a fixed number of bits and wrap round on overflow; this calculator does not, so results such as 2⁶⁴ are exact. Check whether your result fits the type you are using: an unsigned 8-bit value holds 0 to 255.

For decimal to binary step by step, see decimal to binary.

How to use it

  1. Choose the base the numbers are written in and the operation.
  2. Type the two numbers; prefixes such as 0b and 0x are fine.
  3. Read the result in binary, decimal, hexadecimal, and octal.

Privacy & limitations

Everything is calculated in your browser.

Related tools

Frequently asked questions

How do I add binary numbers by hand?

Right to left, like decimal, carrying 1 whenever a column adds up to 2: 1 + 1 = 10, so write 0 and carry 1.

What does shifting do?

Shifting left by n multiplies by 2ⁿ and shifting right divides by 2ⁿ, dropping the remainder: 0xFF >> 4 = 0xF.

What is two's complement?

The way computers store negative integers: invert all the bits of the positive number and add 1, so −5 in 8 bits is 11111011.

Free tool · runs in your browser · no account required