CALCULATORCASTLE

Big Number Calculator

Perform arithmetic on very large numbers that exceed standard calculator precision.

About

Big Number Calculator

A pocket scientific calculator carries about 10 to 12 digits. A spreadsheet or a browser carries about 16. Past that the machine stops storing your number and starts storing an approximation of it, silently. This calculator does not do that. It keeps every digit, so 20,000 factorial comes out in full rather than as an overflow error, and a 300-digit product is exact rather than rounded at the seventeenth place.

Accepted input covers whole numbers, decimals, and the E-notation form of scientific notation, so 23E18 and 3.5e19 both parse. Set the precision field to say how many digits after the decimal point you want back from division and square root, and pick an operation.

Why ordinary calculators run out of room

Nearly every computer stores non-integer numbers as an IEEE 754 double: one sign bit, 11 bits of exponent and 52 stored bits of significand, which behaves as 53. That works out at 15.95 decimal digits of accuracy. It is a fixed budget, and it does not stretch when your numbers get interesting.

The effect is easy to see. In any language using doubles, 0.1 + 0.2 evaluates to 0.30000000000000004, because neither 0.1 nor 0.2 has an exact binary representation. Whole numbers hit a harder wall: the largest integer a double can represent without gaps is 9,007,199,254,740,991, which is 2 to the 53rd minus 1. Add 2 to it and you get 9,007,199,254,740,992, the same answer you get from adding 1, because the number line has holes in it up there. This calculator returns 0.3 for that first sum, exactly, because it works in decimal on whole-number significands rather than in binary floating point.

The way round the limit is arbitrary-precision arithmetic, where a number is held as an array of digits and grows as needed until memory runs out. Python has used it for ordinary integers since version 3. Java has BigInteger, C and C++ programmers reach for GMP, and JavaScript gained a native BigInt type in ES2020, which is what this page runs on.

Where big numbers actually come up

Cryptography is the biggest everyday consumer. An RSA-2048 key is a 617-digit number, and its security rests on the fact that nobody can factor it back into its two primes in reasonable time. The published RSA-250 challenge number, 250 digits, was factored in February 2020 and took roughly 2,700 core-years of computing. Every one of those operations is arbitrary-precision arithmetic.

Combinatorics gets large faster than most people expect. A deck of 52 cards can be arranged in 52 ways, which is 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000, a 68-digit number. Shuffle properly and the order you produce has, in all likelihood, never existed before.

Physics and astronomy supply the rest. Avogadro's constant has been exactly 6.02214076 x 10^23 since the SI redefinition took effect in May 2019, when it stopped being measured and became a definition. The observable universe holds somewhere around 10^80 atoms. Prime hunting produces the extreme end: the largest known prime, 2^136,279,841 minus 1, was found in October 2024 and runs to 41,024,320 digits, which would fill roughly 15,000 printed pages.

Naming the powers of ten

English names for large numbers follow the short scale, where each new name is a thousand times the last.

Power of 10Name
10^9Billion
10^12Trillion
10^15Quadrillion
10^18Quintillion
10^21Sextillion
10^24Septillion
10^27Octillion
10^30Nonillion
10^33Decillion
10^36Undecillion
10^39Duodecillion
10^42Tredecillion
10^45Quattuordecillion
10^48Quindecillion
10^51Sexdecillion
10^54Septendecillion
10^57Octodecillion
10^60Novemdecillion
10^63Vigintillion
10^100Googol
10^303Centillion
10^googolGoogolplex

The long scale, still used across much of continental Europe, puts a billion at 10^12 and inserts milliard for 10^9. Britain used the long scale officially until 1974. If you are reading a translated document or anything written before then, check which convention it follows before trusting a figure.

Googol was named in 1920 by Milton Sirotta, the nine-year-old nephew of the mathematician Edward Kasner, who asked him what to call a one with a hundred zeros after it. The boy also supplied googolplex, a one followed by a googol of zeros. That one cannot be written out anywhere: it has more digits than the universe has atoms to record them with.

Past the point where notation gives up

Some numbers in mathematics are too large for exponent towers to express conveniently, so specialist notations were invented. Knuth's up-arrow notation writes repeated exponentiation as a single arrow and repeated tetration as two, and keeps stacking. Conway chained arrow notation and the Steinhaus-Moser polygon notation do similar work by different routes.

Graham's number is the usual example. It arose as an upper bound in a Ramsey theory problem and is defined by 64 layers of up-arrow recursion, each layer using the previous one as its arrow count. No exponent tower can express it, yet its last digits are known exactly, ending in 7. That gap, between what can be written and what can be computed about a number, is a good part of why big number arithmetic is a field at all.

What the operations do here

Addition, subtraction and multiplication are exact whatever the size. Division and square root are exact to the precision you set, defaulting to 20 decimal places, and the last kept digit is rounded half away from zero. X^Y expects a whole number exponent and is computed by binary exponentiation, which reaches X^1000 in about 10 squarings rather than 1,000 multiplications. A negative exponent is handled as 1 divided by the positive power.

Factorial takes any whole number from 0 up to 20,000. The famous case is 10,000 factorial, which has 35,660 digits and ends in 2,499 zeros. Those zeros are not a coincidence: each one comes from a factor of 5 pairing with an even number, and counting them is Legendre's formula, 10000/5 plus 10000/25 plus 10000/125 and so on, discarding remainders.

MOD returns the remainder after truncated division, taking the sign of X, which is how the % operator behaves in C, Java and JavaScript. GCD runs the Euclidean algorithm, which is over two thousand years old and still the fastest general method, and the step list shows each division. LCM is derived as the product over the divisor, dividing first so the intermediate value never grows larger than it needs to be.

How multiplication scales

Multiplying two n-digit numbers the way you learned in school costs n squared digit operations, which becomes painful somewhere past a few thousand digits. Anatoly Karatsuba broke that barrier in 1960 with a method costing about n^1.585, disproving a conjecture of Kolmogorov's that n squared was the floor. Toom-Cook generalised it, Schonhage and Strassen brought fast Fourier transforms to the problem in 1971, and in 2019 David Harvey and Joris van der Hoeven published an algorithm running in n log n, which is believed to be the best possible. Every serious bignum library switches between several of these depending on operand size.

Reading the output

The result panel shows the answer with thousands separators when it is short enough to read, and switches to scientific form once it passes 22 digits, with the exact value printed in full underneath. The digit count is worth watching: it is the quickest sanity check on any big calculation, since multiplying an a-digit number by a b-digit number always gives either a+b or a+b-1 digits. The step by step panel shows the working, including the squaring chain for powers, the Newton passes for square roots, and every division in the Euclidean algorithm for GCD.

Common questions

Frequently asked questions

Because it stores numbers as IEEE 754 doubles, which hold 15.95 decimal digits. Anything longer is rounded to fit, and the rounding is invisible. That is also why 0.1 + 0.2 comes out as 0.30000000000000004 in most programming languages. This page works in decimal on exact whole-number significands, so it returns 0.3.

There is no fixed digit limit on addition, subtraction and multiplication; the practical ceiling is your browser memory. Factorials are capped at 20,000, which already produces more than 77,000 digits. Powers are refused above roughly 400,000 digits in the result. Those caps exist to keep the page responsive rather than because the arithmetic breaks down.

It is scientific notation written on one line, with E or e standing for times ten to the power of. So 3.5e19 means 3.5 x 10^19, or 35 followed by 18 zeros, and 23E18 means 23 x 10^18. Negative exponents work too: 1.2e-5 is 0.000012. Both input boxes accept the form and convert it before calculating.

How many digits after the decimal point come back from division and square root, since neither generally terminates. It defaults to 20. Addition, subtraction and multiplication ignore it, because those are exact whatever the size of the inputs. Raising it costs a little speed and nothing else.

It ends in 2,499 of them. Each trailing zero comes from a factor of 10 in the product, and since even numbers are plentiful the count is set by how many factors of 5 appear. The Legendre formula adds 10000/5 = 2000, plus 10000/25 = 400, plus 10000/125 = 80, plus 16, plus 3, discarding remainders, which gives 2,499.

The greatest common divisor is the largest number that divides both inputs exactly, found here with the Euclidean algorithm. The least common multiple is the smallest number both inputs divide into. They are linked: GCD times LCM equals the product of the two numbers, which is how the LCM is computed on this page, dividing before multiplying so the intermediate value stays small.

The remainder takes the sign of X, so -7 MOD 3 gives -1 rather than 2. This matches the % operator in C, Java and JavaScript. Mathematicians and Python use a different convention where the result takes the sign of the divisor, giving 2. Neither is wrong; they differ in whether the quotient is truncated towards zero or rounded down.

Addition, subtraction, multiplication, powers with whole exponents, factorial, MOD, GCD and LCM are exact, with every digit computed. Division and square root are correct to the precision you request, with the final digit rounded half away from zero. The step panel shows a check line for both, squaring the root back or multiplying the quotient by the divisor, so you can see how close the answer lands.