Binary calculator

Arithmetic in binary.

Binary result

10001

Binary
Octal
Decimal
Hex
In decimal

Runs in your browser. Nothing uploaded.

How to do binary arithmetic

  1. Enter two binary numbers (0s and 1s).
  2. Choose the operation: +, −, ×, ÷, AND, OR or XOR.
  3. Read the result in binary, with decimal, octal and hex alongside.

Binary place values

Bit 128 64 32 16 8 4 2 1
1011 0101 1 0 1 1 0 1 0 1

That byte is 128 + 32 + 16 + 4 + 1 = 181. Each place is worth twice the one to its right.

Binary arithmetic by hand

Subtraction borrows 2 instead of 10: 10 − 1 = 1 in binary. Multiplication is shifting and adding, because each digit is 0 or 1: 101 × 11 is 101 + 1010 = 1111 (5 × 3 = 15). That simplicity is why computers work in binary.

Bitwise operations

AND keeps bits that are set in both numbers, which is how a mask picks out part of a value: 1101 AND 0100 = 0100 tests whether the third bit is on. OR sets bits, and XOR flips them; XOR-ing twice with the same value gets the original back.