Binary calculator

Pick a base, enter two numbers and choose an operation. The calculator adds, subtracts, multiplies and divides with a remainder, applies AND, OR and XOR, and shifts bits left or right. The answer appears in your base and in binary, octal, decimal and hex.

Digits of the chosen base. A minus sign and prefixes such as 0b, 0o or 0x are accepted.
Digits of the chosen base. For shifts, B is the number of bits as an ordinary decimal number.
Result1 0001
Octal
21
Decimal
17
Hexadecimal
11

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose the base you are working in: binary, hexadecimal or octal.
  2. Type A and B using digits of that base. Spaces and underscores are ignored.
  3. Choose the operation. For shifts, B is the number of bits in plain decimal.
  4. Read the result in your base and in the other bases below.

How it works

Both numbers are read as exact big integers, the operation is applied, and the result is written out in each base. Binary is grouped in fours for readability; the copy button gives the digits without spaces. Division truncates toward zero and also reports the remainder.

Worked example

1011 + 110 in binary: 11 + 6 = 17, so the result is 10001, which is 21 in octal, 17 in decimal and 11 in hex. Multiplying 1011 × 110 gives 1000010, which is 66 (11 × 6). In hex, FF AND 0F gives 0F, and FF << 4 gives FF0.

Tips

  • Hex digits can be typed in upper or lower case.
  • To test a bit, AND with a mask: 1101 AND 100 is 100, so that bit is set.
  • XOR a number with itself to get 0, and with all ones to flip every bit.

Frequently asked questions

How do I add binary numbers?

Add column by column from the right, as in decimal, but 1 + 1 = 10 in binary: write 0 and carry 1. For 1011 + 110, the columns give 1, 0, 0, 0 with carries and the sum 10001, which is 11 + 6 = 17 in decimal.

How does division work with a remainder?

The quotient is rounded toward zero and the remainder is what is left, so dividend = quotient × divisor + remainder. 1101 ÷ 10 in binary (13 ÷ 2) is 110 with remainder 1.

What do AND, OR and XOR do?

They compare the two numbers bit by bit. AND gives 1 only where both bits are 1, OR where at least one is 1, and XOR where exactly one is 1. For 1100 and 1010, AND is 1000, OR is 1110 and XOR is 0110.

What do the shifts do?

A left shift by n moves the bits n places left and fills with zeros, which multiplies by 2^n. A right shift by n drops the last n bits, which divides by 2^n and rounds down, so −5 >> 1 is −3.

How are negative numbers handled in bitwise operations?

As infinite two's complement, the same as JavaScript BigInt. −1 is all ones, so −1 AND 1010 is 1010. Results are shown with a minus sign, not as fixed-width two's complement words.

Is there a size limit?

Numbers may have up to 256 digits and shifts up to 4,096 bits. Arithmetic is exact, with no overflow.

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.