Binary calculator

Perform arithmetic (+, −, ×, ÷) and logic operations (AND, OR, XOR, NOT) on binary numbers. See the result in binary, decimal, and hex instantly.

Binary calculator

Result (binary)
10110
Decimal
22
Hex
0x16
Octal
0o26

How binary arithmetic works

Binary uses only two digits, 0 and 1. Each position represents a power of 2, starting from 20 on the right. For example, 10102 = 1×23 + 0×22 + 1×21 + 0×20 = 1010.

Addition: 0+0 = 0, 0+1 = 1, 1+1 = 10 (carry 1)

Subtraction, multiplication, and division follow the same column-wise rules you learned for decimal numbers — only the base is different.

Bitwise logic operations

OperationRule (bit-by-bit)Example
AND1 only if both bits are 11010 AND 1100 = 1000
OR1 if either bit is 11010 OR 1100 = 1110
XOR1 if bits differ1010 XOR 1100 = 0110
NOTFlip every bit (within bit-width)NOT 1010 = 0101

FAQ

What's the largest binary number I can enter?

JavaScript supports safe integers up to 253 − 1, which is a 53-bit binary number. Beyond that, precision may drop.

Why does NOT give a different answer than expected?

NOT flips bits within a fixed bit-width. By default we use the shortest bit-width that holds your input. For example, NOT 1010 in 4 bits = 0101.

Can I enter negative numbers?

This calculator treats binary inputs as unsigned positive integers. Subtraction with a larger B will return a negative decimal equivalent.

Related calculators