Math & Statistics · Number Bases · Free

Binary Calculator

Do math directly on binary numbers. Type two base-2 values, choose an operation — add (+), sub (-), mult (×), div (÷), modulo (mod), exp (^), and (&), or (|), not (~), xor (^), left shift (<<) or right shift (>>) — and press Calculate to see the binary, decimal and hex result with full calculation steps. Everything runs locally in your browser.

STEP 1

Enter the first binary number

Type a base-2 value using only 0 and 1 digits, e.g. 1011 (= 11 in decimal). A leading minus sign and binary points are allowed, e.g. -1011 or 1.1. Invalid digits are highlighted in red and clear the previous result.

STEP 2

Pick an operation (and the 2nd number)

Choose from add, sub, mult, div, mod, exp, and, or, not, xor, left shift or right shift. Only not (~) needs no second number; for shifts the second field is the shift amount in binary, e.g. 10 means shift by 2.

STEP 3

Press Calculate, read three bases

The result appears in binary, decimal and hex, plus the calculation steps, e.g. 1011 + 10 = 11 + 2 = 13 = 1101₂. Tick Digit grouping to space the digits (4 294 967 284), and copy any result with its Copy button.

Binary arithmetic and bitwise operations

Binary addition example
Add the values as powers of two first: 1011₂ + 10₂ = 11₁₀ + 2₁₀ = 13₁₀ = 1101₂. The same decimal-bridge works for subtraction, multiplication and division — the calculation steps panel shows each bridge. Division can produce fractional binary, e.g. 11 ÷ 100 = 0.75 = 0.11₂.
Bitwise operations are limited to 32 bits
and (&), or (|), not (~) and xor (^) convert each input with parseInt(x, 2) and apply 32-bit integer logic, just like JavaScript. Values beyond 32 bits wrap, and not (~) renders the unsigned 32-bit complement: ~1011 = 4294967284 = FFFFFFF4₁₆, whose binary result is zero-padded to 32 digits.
How the shifts work
Left shift multiplies by 2 to the power of the shift amount and right shift divides by it: 1011 << 10 = 11 × 2² = 44 = 101100₂, and 1011 >> 1 = 5.5 = 101.1₂. Because right shift is a true division, it can produce fractions instead of discarding bits.
What inputs does the calculator reject?
Any digit other than 0 and 1 (plus one optional sign and one binary point) is rejected: the field is highlighted and all results clear, so a stale result never survives a bad edit. Exponent with a non-binary exponent shows the message "Please enter integer exponent". Dividing or taking modulo by zero returns NaN or Infinity.
When are results padded or grouped?
For exp, and, or and not the binary result is zero-padded to the wider input, so 1 & 10 shows 00. With Digit grouping on, binary is grouped in 8s, decimal in 3s and hex in 2s: 4294967284 becomes 4 294 967 284 and FFFFFFF4 becomes FF FF FF F4.

More number work: browse all Math & Statistics tools.

Privacy: every calculation runs in your browser tab — no value you type is sent anywhere. Copy result uses your clipboard only. Bitwise ops follow 32-bit integer semantics; arithmetic runs on exact binary fractions.