Skip to content
Esc

Binary calculator

Runs in this browser

Type two integers in binary, hexadecimal, octal or decimal, then add, subtract, multiply, divide or apply a bitwise operator. The result is shown in every base at once. This is integer math, not a text-to-code-point converter. The work runs in this tab, so the numbers are never uploaded.

Input base
Operation
Bit width

How to use it

  1. Choose the input base: binary, hexadecimal, octal or decimal. Prefixes such as 0b, 0x and 0o are accepted.
  2. Enter A and B, or try the sample (1010 + 0111). Pick an arithmetic or bitwise operation.
  3. Optionally fix an 8, 16, 32 or 64-bit width so the result wraps. Tick two's complement to read the bits as a signed integer. Copy any of the four results.

Details

Exact integers
Values are exact integers, not floating-point approximations. Division truncates toward zero and also offers a remainder operation
Bases
Binary, octal, decimal and hexadecimal. Spaces and underscores are ignored, so 0001 0100 and 0xFF are fine
Bit width
Auto leaves the full integer. 8, 16, 32 or 64 wrap the result to that many bits. Bitwise NOT and shifts use the working width so there is a defined number of bits to flip
Limits
Up to 1,024 bits. A shift amount cannot be negative or larger than the working width

Questions

Are my numbers uploaded?

No. The calculation runs in this browser tab. Nothing is sent to a server.

How is this different from the ASCII converter?

That page turns letters into Unicode code points (and back) in decimal, hex, binary or octal. This page does arithmetic and bitwise operations on integers. The two jobs are different, and that page is not changed here.

Why is there no separate hex calculator?

Hexadecimal and octal are modes on this page. Switching the input base is the same calculator, not a second URL.

What does a fixed bit width do?

The result is wrapped to 8, 16, 32 or 64 bits. Unsigned 8-bit 255 + 1 becomes 0 and the page notes the wrap. With two's complement on, the same bits can be read as a signed integer, so 8-bit 255 is −1.

Is there an API?

Yes. The MCP tool binary_calculator on this site can calculate or convert. The numbers are not stored.