Big Number Calculator

Work with whole numbers and decimals far too long for a normal calculator. Results are exact to the last digit, and long answers are laid out in rows you can read on any screen.

Up to 5,000 digits. Commas and spaces are ignored; E notation such as 1e50 works.
Used when a result has more decimals than this (division, decimal inputs). 0 to 1,000.

Result

A × B =
1,219,326,311,370,217,952,237,463,801,111,263,526,900
  • Scientific notation≈ 1.219326311 × 10^39
  • Number of digits40
  • Sum of digits135

How to use the big number calculator

  1. Enter number A and, for most operations, number B. Commas, spaces and line breaks are ignored, so you can paste numbers straight from a document. A leading minus sign and one decimal point are allowed. E notation such as 1e100 is expanded exactly.
  2. Choose an operation: add, subtract, multiply, divide, power, mod, GCD and LCM, or factorial.
  3. Set the decimal places. This only matters when the exact answer would have more decimals than you want, as in 1 ÷ 7, decimal powers or negative powers.

If the answer has up to 40 digits it appears in full as the main result. Longer answers show a 10-significant-figure approximation on top and every digit in a table below, in rows of up to 24 digits. Long tables are folded away until you open them.

Worked example: a 40-digit product

The page opens with two 20-digit numbers:

  • A = 12,345,678,901,234,567,890
  • B = 98,765,432,109,876,543,210

Their product is

1,219,326,311,370,217,952,237,463,801,111,263,526,900

That is 40 digits whose digits add up to 135. Do the same on a phone calculator and you get about 1.2193263 × 10^39. The first eight digits are right, and every later digit has been lost to rounding.

As a quick check, the product of two 20-digit numbers has 39 or 40 digits. Also, 890 × 210 = 186,900, which ends in 900, the same three digits as the exact answer.

What each operation does

Operation Notes
A + B, A − B, A × B Exact for whole numbers and decimals
A ÷ B Decimal quotient to your chosen places; whole numbers also get the quotient and remainder
A^B B must be a whole number; a negative B gives a decimal (1 ÷ A^|B|)
A mod B Remainder with the sign of B, plus the check A = q × B + r
GCD and LCM Euclid’s algorithm; LCM = |A × B| ÷ GCD
A! Product 1 × 2 × … × A, for A from 0 to 1,000

For each whole-number result you also get its digit count and digit sum. A number is divisible by 3 exactly when its digit sum is, and by 9 exactly when its digit sum is divisible by 9.

Where exact big numbers come up

  • Cryptography lessons. RSA works with numbers hundreds of digits long, and modular arithmetic is the core step.
  • Combinatorics. Factorials grow fast: 20! is already 2,432,902,008,176,640,000, and 52!, the number of ways to shuffle a deck of cards, has 68 digits.
  • Checking code. If your program uses 64-bit integers, compare its output with an exact result to spot overflow.

For prime factors of numbers up to 10^18, use the prime factorization calculator. For fractional or very large exponents shown in scientific notation, use the exponent calculator.

Limitations

Inputs are capped at 5,000 digits and results at 20,000 digits, to keep the page responsive on phones. Roots, logarithms and other non-integer powers are not supported here, because their exact values have endless digits.

Frequently asked questions

How big can the numbers be?

Each input can have up to 5,000 digits, and a result can have up to 20,000 digits. Factorials are available up to 1,000!, which has 2,568 digits.

Why does a normal calculator get big numbers wrong?

Most calculators and programming languages store numbers as 64-bit floating point, which keeps only about 15 to 17 significant digits. Beyond that the last digits are lost, so 2^64 + 1 shows up as 2^64. This calculator stores every digit exactly.

What does mod mean for negative numbers?

The result here takes the sign of the divisor, the convention used in mathematics and in Python, so −17 mod 5 = 3. C, Java and JavaScript instead keep the sign of the dividend and give −2. When the two differ, the calculator shows both.

How accurate is division?

Whole-number division gives an exact quotient and remainder. The decimal quotient is worked out digit by digit to the number of decimal places you choose, up to 1,000, and the last digit is rounded half up.

Last reviewed: