Skip to main content

Multi-Base Arithmetic Calculator

Add, subtract, multiply, divide or take the modulo of two numbers written in binary, octal, decimal or hexadecimal — bases auto-detected from a 0x/0b/0o prefix. Uses BigInt for arbitrary precision and shows the result in all four bases at once, with fixed-width overflow reporting and step-by-step working.

Input

Prefix with 0b (binary), 0o (octal), 0x (hex). No prefix = decimal.

Prefix with 0b (binary), 0o (octal), 0x (hex). No prefix = decimal.

Used to detect fixed-width overflow. Unlimited uses arbitrary-precision BigInt.

Output

Result in all bases

Result
BaseValue
No data yet
Working steps
 
Was this helpful?

Guides

The Multi-Base Arithmetic Calculator adds, subtracts, multiplies, divides, and takes the modulo of two whole numbers written in binary, octal, decimal, or hexadecimal — and shows the answer in all four bases at once. It is built for programmers, students, and anyone working close to the metal, where a value might be a hex mask, a binary flag field, and a decimal count all at the same time.

How it works

Type each operand into its field. The base is detected automatically from the prefix you use:

  • 0b — binary (e.g. 0b1010 = 10)
  • 0o — octal (e.g. 0o17 = 15)
  • 0x — hexadecimal (e.g. 0xFF = 255)
  • no prefix — decimal (e.g. 255)

You can mix bases freely — add a hex number to a binary one, divide a decimal by an octal. An optional leading - sign is allowed, and underscores (0xDE_AD_BE_EF) are ignored so long values stay readable. Pick an operation, and the result appears immediately in binary, octal, decimal, and hexadecimal, each prefixed so you can copy any row straight back into the calculator.

Operations

  • Addition (+), Subtraction (−), Multiplication (×)
  • Division (/) — integer division, truncated toward zero (255 / 10 = 25)
  • Modulo (%) — the remainder (255 % 10 = 5)

Every calculation runs on BigInt, so there is no upper limit on operand size and no floating-point rounding. A 64-hex-digit value multiplies exactly, where an ordinary JavaScript Number would silently lose precision above 2⁵³.

Bit width and overflow

Set a bit width (8, 16, 32, or 64) and the calculator reports whether the result fits a fixed-width register. When it does not, it shows the wrapped two's-complement interpretation for both signed and unsigned reads — exactly what a CPU register of that size would hold. Leave the width on Unlimited to work in pure arbitrary-precision BigInt with no overflow.

Working steps

For reasonably small operands the tool prints the long-hand working: column carries for addition, column borrows for subtraction, shift-and-add partial products for multiplication, and a step table for binary long division. It is a quick way to check homework or to see why an answer comes out the way it does.

How are negative results shown?

A negative result is written as a leading minus sign followed by the magnitude's digits in each base — for example -0xF5, -0b11110101, -245. BigInt has no fixed width, so there is no infinite two's-complement bit pattern to display; if you want the fixed-width two's-complement form, choose a bit width and read the overflow status line.

Is my data sent anywhere?

No. Every calculation runs entirely in your browser — nothing you type is uploaded.

binaryhexadecimaloctalarithmeticbitwisenumberprogrammer

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.