Binary Calculator

Binary arithmetic, bitwise AND / OR / XOR, shifts, and conversion between binary, decimal, and hex. Every result is exact, updates as you type, and is computed entirely in your browser.

Binary arithmetic

Example: 1010 + 0110 = 10000.

Enter two binary values to see the result.

Bitwise operations & shifts

Example: 1100 AND 1010 = 1000.

Enter values to see the bitwise result.

Binary ↔ decimal converter

Example: 1010 in binary is 10 in decimal.

Enter a value to convert it.

How binary works

Binary is base 2: only the digits 0 and 1, with each column worth twice the one to its right — 1, 2, 4, 8, 16, and so on. The number 1010 is 8 + 2 = 10. Every value in a computer — numbers, text, pixels, machine code — is ultimately stored this way, which is why binary literacy underpins all low-level programming.

Binary arithmetic follows the same carrying rules you know from decimal, just with a carry at two instead of ten: 1 + 1 = 10. Adding 1010 and 0110 carries twice and produces 10000 — sixteen in decimal.

Bitwise operations, in practice

Bitwise operators treat numbers as rows of independent bits. For A = 1100 and B = 1010: AND gives 1000 (only bit 3 is set in both), OR gives 1110 (any bit set in either), and XOR gives 0110 (bits that differ). Programmers use AND to mask flags off, OR to switch them on, and XOR to toggle or compare. Shifts move all bits: 101 << 3 is 101000 — the value 5 becomes 40, because each left shift doubles.

Why binary pairs with hex

Long bit strings are hard to read, so programmers group bits in fours and write each group as one hexadecimal digit: 1110 1111 becomes EF. The conversion is mechanical in both directions, which is why this calculator shows hex alongside every result. For hex-first work, see the Hex Calculator.

Frequently asked questions

How do I read a binary number?

Each column is a power of two, doubling right to left: 1, 2, 4, 8, 16… So 1010 means 8 + 2 = 10 in decimal. Leading zeros change nothing — 0110 and 110 are both six.

What do AND, OR, and XOR actually do?

They compare two numbers bit by bit. AND keeps a 1 only where both bits are 1 (used for masking bits off), OR sets a 1 where either bit is 1 (setting bits), and XOR sets a 1 where the bits differ (toggling bits). 1100 AND 1010 = 1000; 1100 OR 1010 = 1110; 1100 XOR 1010 = 0110.

Why does shifting left multiply by two?

Shifting every bit one column left moves each bit to a place worth twice as much, so the whole value doubles — exactly as appending a zero multiplies a decimal number by ten. 101 << 3 appends three zeros: 101000, i.e. 5 × 8 = 40.

Why are bitwise operations limited to non-negative numbers here?

Bitwise results for negative numbers depend on two’s-complement representation at a fixed bit width (8, 16, 32, 64…), which a general calculator cannot assume. Arithmetic (+, −, ×, ÷) supports negatives normally.

All values are processed locally in your browser and never transmitted. Formulas are implemented as tested, typed functions — see the methodology page.