Skip to content
ENExplore Calculators

Binary Calculator

Do binary arithmetic and bitwise operations, and convert between bases.

About Binary Calculator

Binary is base-2: only digits 0 and 1. Each position is a power of 2. Binary arithmetic follows the same rules as decimal but carries happen at 2 (not 10). Bitwise operations work bit-by-bit on the binary representations: AND returns 1 only where both bits are 1; OR where at least one is 1; XOR where exactly one is 1; NOT flips all bits. Shifts multiply (<<) or divide (>>) by powers of 2.

Formulas

Binary to decimal

d = Σ bᵢ × 2ⁱ (sum of bit values)

Bitwise identities

AND: 1 only if both 1. OR: 1 if either 1. XOR: 1 if exactly one 1.

Worked example

With the default values below, Binary Calculator returns Binary of 11111111. Change any input above and every figure here is recalculated in your browser.

Inputs used

Modeone of Base Conversion, Binary Arithmetic, Bitwise Operations
Base Conversion
Decimal numberaccepts 0–4,294,967,295
255
Binary value A
1010
Operationone of Add (+), Subtract (−), Multiply (×), Divide (÷)
Add (+)
Binary value B
110
Binary value A (up to 32 bits)
1100
Bitwise operationone of AND, OR, XOR, NOT (A only), Left shift (A << n), Right shift (A >> n)
AND
Binary value B (or shift amount n)
1010

Results

Binary
11111111
Decimal
255
Hexadecimal
FF
Octal
377

Step by step

  1. 1Decimal input= 255
  2. 2Binary (base 2)= 11111111
  3. 3Octal (base 8)= 377
  4. 4Hexadecimal (base 16)= 0xFF

Assumptions and limits

  • The result is derived only from the 8 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What is 255 in binary?

255 = 11111111₂ — eight 1 bits, because 2⁸ − 1 = 255. It's also 0xFF in hexadecimal and 0o377 in octal. This is the maximum value of an unsigned 8-bit byte.

What does XOR do and why is it useful?

XOR (exclusive OR) outputs 1 only when the two input bits differ. It's used in cryptography (XOR with a key), error detection (parity), and the classic bit-swap trick (a^=b; b^=a; a^=b swaps two variables without a temporary).

How does left-shift multiply by 2?

Shifting bits left by n places is the same as multiplying by 2ⁿ. For example, 5 = 101₂; 5 << 1 = 1010₂ = 10 = 5 × 2. Right shift divides by 2ⁿ (integer division).

Binary Calculator – Calculate Binary & Decimal | Calcrivo