Big number calculator

Add, subtract, multiply, divide, modulo, exponentiate, square, square-root, or take the GCD / LCM of numbers with hundreds of digits — far beyond what a normal calculator can handle. Both integer and decimal inputs work, and division & square-root precision is configurable.

Big number arithmetic

Result a + b
1111111110111111111011111111100
digits: 31 decimal places: 0 scientific: 1.111×10³⁰

How big can the numbers be?

Effectively as big as you want. The implementation uses JavaScript's native BigInt, which has no fixed size limit; the practical ceiling is just memory and how long you're willing to wait. Multiplying two 10 000-digit numbers takes a fraction of a second; multiplying two 1 000 000-digit numbers will take noticeably longer.

How decimal arithmetic works here

The calculator stores each number as (integer value, decimal scale). To add 12.34 and 5.6, it scales both to a common decimal place: 1234 with scale 2, and 560 with scale 2. Then it just adds the integers: 1794, scale 2 → 17.94. No floating-point rounding ever happens for + − × mod, regardless of size.

Division is the only exception. To compute a ÷ b to 50 decimal places, the calculator multiplies a by 10⁵⁰ first, then does an exact integer division. The remainder beyond 50 digits is truncated.

Worked examples

  • Sum of 100-digit numbers — exact result, no rounding.
  • 2¹⁰⁰⁰ — try a = 2, op = ab, b = 1000. The result has 302 digits.
  • π ≈ 22 ÷ 7 to 200 decimals — set a = 22, b = 7, op = ÷, decimal precision = 200.
  • √2 to 100 decimals — set a = 2, op = √a, decimal precision = 100.
  • (123!)² — set a to 123 factorial (200+ digits), op = a², result has ~400 digits, exact.
  • Modulo — useful for cryptography. (a × b) mod n stays exact for any input size.
  • GCD / LCM — set both inputs to large integers; the calculator runs the binary Euclidean algorithm and returns the answer instantly even for 100-digit operands.

FAQ

Are negative numbers supported?

Yes — prefix with a minus sign. Subtraction, signed multiplication, modulo with negative dividend (truncated toward zero, JavaScript-style), and signed division all work as expected.

Why is ab only allowed when b is a non-negative integer?

For arbitrary real exponents you'd need a transcendental function (logarithm + exponential), which can't be evaluated exactly with bignum integers — it has to be approximated. We keep this calculator strictly exact, so we restrict ab to integer exponents. For arbitrary exponents, see the root & power calculator.

Can I paste in scientific notation like 1.5e30?

Not directly — the input format is plain decimal, so type 1500000000000000000000000000000 instead. This keeps the round-trip exact. Commas in the input are fine; they're stripped automatically (and added back as thousands separators while you type).

How is square root computed?

It uses Newton's method on BigInt to find the integer square root, then scales by 10^(2·precision) to extract decimal digits. Result is truncated, not rounded — so √2 to 100 decimals is the first 100 digits of the exact expansion.

Do GCD and LCM allow decimal inputs?

No — GCD and LCM are defined for integers. The calculator returns an error if either input has a fractional part. Strip the decimal point or scale both numbers up by 10ⁿ first if you need a "rational GCD".

Related calculators