Binary Calculator

Add, subtract, multiply, divide, AND, OR, XOR and shift binary numbers

  • 100% Free
  • Files stay private
  • Works in your browser
Try it now·Binary Calculator
binary
binary

Operands are parsed as binary with arbitrary precision (an optional 0b prefix and grouping spaces/underscores are accepted). Division is integer division (truncated toward zero); for shifts, operand B is the number of bits to shift. Everything is computed live in your browser.

How it works

  1. Enter two binary numbers

    Type binary values into the Operand A and Operand B fields, for example 1010 and 0110.

  2. Choose an operation

    Pick one from the Operation menu, such as Add, XOR or Left shift, then press Calculate.

  3. Copy any result base

    The Result panel shows the answer in Binary, Decimal and Hexadecimal rows, each with its own Copy button.

The Binary Calculator is a free online tool that applies arithmetic, bitwise and shift operations to two binary operands and shows the result in binary, decimal and hexadecimal at once. It supports 9 operations and uses arbitrary-precision integers, so results never overflow. Programmers, computer science students and anyone working with bit masks use it to check a value without opening a REPL.

At a Glance

DetailSummary
What it doesComputes A op B on two binary numbers
InputTwo operands in binary. A 0b prefix, spaces and underscores are fine
OperationsAdd, Subtract, Multiply, Divide, AND, OR, XOR, Left shift, Right shift
OutputBinary, decimal and hexadecimal, each separately copyable
PrecisionArbitrary. BigInt, so no 32-bit or 64-bit ceiling
Runs whereYour browser. No server round-trip
PriceFree, no sign-up
Best forBit masks, shifts and checking binary arithmetic

What Is the Binary Calculator?

The Binary Calculator parses both operands into BigInt values, applies your chosen operation, and renders the answer in three bases. The menu is grouped: Arithmetic (Add, Subtract, Multiply, Divide), Bitwise (AND, OR, XOR) and Shift (Left shift, Right shift). Each entry shows its symbol, such as XOR (A ^ B).

BigInt is the part that matters. JavaScript's own bitwise operators coerce their arguments to 32-bit signed integers, so a mask wider than 32 bits silently wraps. This calculator never does. Results appear when you press Calculate, along with the decimal value of each operand so you can check what the tool read.

How the Binary Calculator Is Different

Most binary calculators lean on the host language's bitwise operators, which quietly cap at 32 bits.

AspectTypical calculatorThis tool
Precision32-bit bitwise, wraps silentlyBigInt, no size limit
OperationsOften the 4 arithmetic ones9, across arithmetic, bitwise and shift
OutputA single baseBinary, decimal and hex, each copyable
Input toleranceBare digits only0b prefix, spaces, underscores, sign

Who Benefits from This Tool

  • Embedded developers: register masks and shifts checked before they reach firmware.
  • Students: verify binary addition and subtraction worked by hand.
  • Network engineers: AND against a mask to see what a bit pattern leaves behind.
  • Reverse engineers: XOR two values and read the differing bits.
  • Teachers: a demonstration that a left shift by one doubles a value.

Key Features

  • Nine operations: four arithmetic, three bitwise and two shifts, in one grouped menu.
  • Three bases at once: binary, decimal and uppercase hex, each with a copy button.
  • Arbitrary precision: BigInt operands of any width, with no overflow.
  • Operand echo: the decimal value of A and B, to confirm the parse.
  • Forgiving input: an optional sign or 0b prefix, plus grouping spaces.
  • Swap: exchanges A and B and recalculates, which matters for Subtract and Divide.

How to Use

  1. Type operand A in binary, such as 1010.
  2. Type operand B in binary. For a shift, this is the bit count, still written in binary.
  3. Pick an operation from the grouped menu.
  4. Press Calculate.
  5. Read the binary, decimal and hex rows and copy what you need.

Worked Example

Press Try sample: A = 1010, B = 0110, Add. Those are 10 and 6 in decimal, which the panel echoes. The answer is binary 10000, decimal 16, hex 10.

Keep the operands and change the operation: AND gives 10 (2), OR gives 1110 (14), XOR gives 1100 (12), Multiply gives 111100 (60), Divide gives 1, because 10 divided by 6 truncates.

Shifts have a trap. Set A = 1010, B = 10, Left shift. Operand B is binary, so it means 2, not ten. The result is 101000, decimal 40.

Common Use Cases

  • Applying a bit mask with AND to isolate specific flags.
  • Setting flags with OR, or toggling them with XOR.
  • Confirming that a left shift by n multiplies by 2 to the power n.
  • Converting a binary value to hex without a separate tool.

Tips and Best Practices

  • Group long operands with underscores. 1010_1010 is easier to proofread.
  • Remember operand B is binary for shifts too. Writing 1000 shifts by 8, not by a thousand.
  • Use the operand echo. A surprising decimal value means the input is wrong.
  • Subtract and Divide are not commutative, so use Swap rather than retyping.
  • Paste with a 0b prefix straight from source code. The parser strips it.

Limitations and Notes

Both operands must be binary. There is no decimal, hex or octal input mode, and the output bases are fixed. Every operation takes two operands, so there is no NOT. Division is integer division truncated toward zero, so 10 divided by 6 is 1 and no remainder is reported. Negative values use sign-magnitude form, so -4 displays as -100 rather than two's complement, since arbitrary precision has no fixed word size to complement within. Left shifts are capped at 4096 bits, and a negative shift count is rejected. Results are not live: change an operand and press Calculate again.

FAQs

Nine: Add, Subtract, Multiply and Divide for arithmetic; AND, OR and XOR for bitwise; plus Left shift and Right shift. Every one takes two operands, so there is no NOT operation.

No. Both operands are read as binary. An optional 0b prefix is stripped, but the digits must be 0 and 1.

No practical limit. Operands are parsed into BigInt, so a value wider than 32 or 64 bits computes exactly instead of wrapping. Only left shifts are capped, at 4096 bits.

Because division is integer division, truncated toward zero. That is 10 divided by 6, which is 1 remainder 4, and only the quotient is reported.

Two's complement needs a fixed word size, such as 8 or 32 bits. These operands have no fixed width, so the result uses sign-magnitude form with a leading minus.

Operand B is binary for shifts, like operand A. Entering 10 shifts by two, not by ten. Check the operand echo to confirm the bit count.

More Binary Converter Tools

Other tools in Binary Converter Tools.

All Binary Converter Tools