Big Number Calculator

Do exact arithmetic on whole numbers far too long for an ordinary calculator, see how many digits the answer has, and copy every digit of the result.

Your results

–

Save this calculation and come back to it any time. Members only — $5 every 3 months, ad-free.

Become a member

How to use the big number calculator

  1. Type or paste number A. It can have thousands of digits. Spaces, commas and underscores are ignored, and you can write 1e50 for 1 followed by 50 zeros.
  2. Choose the operation: add, subtract, multiply, divide with a remainder, mod, a power, the GCD and LCM, or the factorial of A.
  3. Enter number B for operations that need two numbers.
  4. Short answers appear in full. Long ones are summarized in scientific notation, and every digit is in the box underneath, ready to copy.

This calculator works with whole numbers only. Exact arithmetic with long decimals needs a fixed number of decimal places, which is a different tool. For very large or small decimals, use the scientific notation calculator.

How the arithmetic works

A = B × q + r, 0 ≤ |r| < |B| A mod B = the remainder in the range 0 to |B| − 1 GCD(A, B) = GCD(B, A mod B), GCD(A, 0) = |A| LCM(A, B) = |A × B| ÷ GCD(A, B) n! = 1 × 2 × 3 × … × n

Ordinary calculators and spreadsheets store numbers as 64-bit floating point, which keeps only about 15 to 17 significant digits. Anything beyond that is silently rounded, so 2⁶⁴ usually shows as 18,446,744,073,709,552,000 or 1.84467E+19 instead of the true 18,446,744,073,709,551,616. This calculator uses JavaScript's BigInt type, which keeps every digit, so sums, products and remainders are exact however long they get.

For division, q is the quotient with the fraction dropped and r is what is left over. Powers use repeated squaring, which needs about 2 × log₂(B) multiplications rather than B of them. The GCD uses Euclid's algorithm: keep replacing the larger number with its remainder after dividing by the smaller one until the remainder is 0.

Worked example

The calculator opens with two 30-digit numbers:

A = 123,456,789,012,345,678,901,234,567,890 and B = 987,654,321,098,765,432,109,876,543,210.

A 30-digit number times a 30-digit number has 59 or 60 digits. Here the product is

121,932,631,137,021,795,226,185,032,733,622,923,332,237,463,801,111,263,526,900

which has 60 digits. Rounded to 10 significant figures that is 1.219326311 × 10⁵⁹, the figure shown in the result, with the exact digits in the copy box.

Limits

Operation Limit
Inputs A and B up to 20,000 digits each
Power A^B result up to 100,000 digits, exponent up to 1,000,000
Factorial A! A up to 5,000 (16,326 digits)
Divide, mod B can't be 0

The limits keep the page responsive on a phone. Within them every answer is exact.

Big numbers in practice

Large integers show up more often than you might expect. Encryption keys are numbers hundreds of digits long, and checking a key means computing a huge power mod another huge number. Combinatorics produces factorials quickly: a deck of 52 cards can be shuffled in 52! ways, a 68-digit number. Number puzzles, Project Euler problems and checking homework on large multiplications all need exact digits rather than a rounded estimate.

Frequently asked questions

Why does my calculator show the wrong last digits?

Standard calculators keep about 15 significant digits and round the rest. 2⁶⁴ really ends in …551,616, but a phone or spreadsheet shows …552,000 or switches to 1.84467E+19. For exact digits you need integer arithmetic of arbitrary length, which is what this tool does.

How are negative numbers divided?

The quotient is rounded toward zero, so -7 ÷ 2 gives -3 with remainder -1, because 2 × (-3) + (-1) = -7. This matches most programming languages. The mod operation instead always returns a number from 0 up to |B| − 1, so -7 mod 2 is 1.

How many zeros are at the end of 100!?

Each trailing zero comes from a factor 10 = 2 × 5, and factors of 5 are the scarcer ones. Count them: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24 zeros. The calculator shows this count for every factorial.

Can it handle decimals or fractions?

No. It is built for whole numbers so that every answer is exact. For fractions, use the fraction calculator. For decimals that are only very large or very small, scientific notation is usually enough.

Related calculators

  • Scientific Notation Calculator — Convert numbers to scientific, E and engineering notation and back, and add, subtract, multiply or divide in a × 10ⁿ form.
  • Exponent Calculator — Raise any number to any power, including negative and fractional exponents, or solve for the exponent or the base.
  • Long Division Calculator — Long division with every step shown: quotient, remainder and the decimal answer with repeating digits marked.
  • Prime Factorization Calculator — Break a number into prime factors with exponents, see the factor tree, check if it is prime and count its divisors.

Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.