Factorial Calculator – Find n! Exactly, Even for Big Numbers
Type any whole number and get its exact factorial, worked out step by step. Ordinary calculators round off once the answer gets big, but this one uses exact whole-number arithmetic, so 100! comes out digit-perfect, and for numbers above 1,000 you still get the digit count and a scientific-notation estimate.

Your number
Whole numbers only, from 0 up to 10,000. Negative numbers and decimals have no factorial in this calculator.
Your number never leaves this page. Everything is calculated in your browser.
Result
At a glance
Tip: n! counts the ways to arrange n different items in a row. So 5! = 120 means five books can be ordered on a shelf in 120 different ways.
Copied!How factorials grow
Each step multiplies by one more number, so factorials explode fast. Here is the ladder from 0! to 20! — notice how 20! already has 19 digits.
| n | n! | Digits |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 1 | 1 |
| 2 | 2 | 1 |
| 3 | 6 | 1 |
| 4 | 24 | 2 |
| 5 | 120 | 3 |
| 6 | 720 | 3 |
| 7 | 5,040 | 4 |
| 8 | 40,320 | 5 |
| 9 | 362,880 | 6 |
| 10 | 3,628,800 | 7 |
| 15 | 1,307,674,368,000 | 13 |
| 20 | 2,432,902,008,176,640,000 | 19 |
Related tools
How it works
Type a whole number
Enter n, from 0 up to 10,000. The calculator only accepts whole numbers.
It multiplies step by step
n! is 1 × 2 × 3 all the way up to n, computed with exact whole-number arithmetic.
Read the extras
See the digit count, trailing zeros, scientific notation, and the previous factorial.
n! = 1 × 2 × 3 × … × n, and 0! = 1 by definition
Worked example — 5!: 5 × 4 × 3 × 2 × 1 = 120. And 10! = 3,628,800, which you can check in the table above. Why is 0! = 1? Because there is exactly one way to arrange zero items: the empty arrangement. It also keeps the rule n! = n × (n − 1)! working at n = 1, since 1! = 1 × 0! = 1.
Big numbers: up to 1,000! the exact answer is shown in full (1,000! has 2,568 digits). Above 1,000, the full answer would be thousands of digits long, so the calculator shows the digit count and a scientific-notation estimate instead, and says so plainly.
Digging deeper
Each new number multiplies everything that came before. Going from 10! to 20! does not double the answer, it multiplies it by 11 × 12 × … × 20, which is about 670 billion. That is why 100! has 158 digits while 10! has only 7, and why ordinary calculators give up and switch to rounded scientific notation around 170!.
Anywhere counting arrangements matters: permutations (how many ways to order items), combinations (how many ways to choose items), probability (the binomial distribution), and series in calculus, where e to the power x and sine are built from factorials in their denominators. If you have ever asked “how many different passwords can I make from these characters”, a factorial was hiding in the answer.
Reading the result, from 5! to 2,000!
The default result is the smallest worked example that shows every part of the panel at once. Type 5 and the calculator shows 5! = 120, written out as 5 × 4 × 3 × 2 × 1 = 120, with 3 digits, 1 trailing zero, the scientific notation 1.200000e+2, and the previous factorial, 4! = 24. Every figure in this section was read from the calculator’s own displayed results for the stated inputs, and the same four extras — digit count, trailing zeros, scientific notation, and the previous factorial — appear for every whole number you type, up to the estimate mode described below.
The two ends of the small ladder are worth reading carefully, because they answer the two questions every reader asks first. At the bottom, 0! = 1, by definition: 1 digit, 0 trailing zeros, scientific notation 1.000000e+0, and no previous factorial, shown as a dash, because there is no (−1)! to show. The reason 0! = 1 is the one the base guide gives: there is exactly one way to arrange zero items, the empty arrangement, and defining it as 1 keeps the rule n! = n × (n − 1)! working at n = 1, since 1! = 1 × 0! = 1. At the top of the small ladder, 10! = 3,628,800, written out as 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800, with 7 digits, 2 trailing zeros, scientific notation 3.628800e+6, and the previous factorial 9! = 362,880. You can check the recurrence by hand: 10 × 362,880 = 3,628,800.
One step further shows why factorials outgrow intuition so fast. 20! = 2,432,902,008,176,640,000, with 19 digits, 4 trailing zeros, scientific notation 2.432902e+18, and the previous factorial 19! = 121,645,100,408,832,000. Again the recurrence checks: 20 × 121,645,100,408,832,000 = 2,432,902,008,176,640,000. Going from 10! to 20! does not double the answer, as the base guide warns: it multiplies it by 11 × 12 × … × 20, which is 670,442,572,800, about 670 billion. That single multiplication is why 100! has 158 digits while 10! has only 7, and why ordinary calculators give up and switch to rounded scientific notation around 170! — the base guide’s figure — while this calculator keeps going with exact whole-number arithmetic.
| n | n! | Digits | Trailing zeros |
|---|---|---|---|
| 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 |
| 5 | 120 | 3 | 1 |
| 10 | 3,628,800 | 7 | 2 |
| 15 | 1,307,674,368,000 | 13 | 3 |
| 20 | 2,432,902,008,176,640,000 | 19 | 4 |
| 100 | Printed in full (158 digits) | 158 | 24 |
| 1,000 | Printed in full (2,568 digits) | 2,568 | 249 |
| 2,000 | Estimate only: ≈ 3.316275e+5735 | 5,736 | 499 |
The last three rows of that table mark the calculator’s three regimes, and the distinction matters for how you read the panel. Up to 1,000!, the exact answer is printed in full: 100! is printed in full with 158 digits and 24 trailing zeros, and 1,000! is printed in full with 2,568 digits, as the base guide states. Above 1,000, the full answer would be thousands of digits long, so the calculator shows the digit count and a scientific-notation estimate instead, and says so plainly: 2,000! is shown as ≈ 3.316275e+5735, with 5,736 digits and 499 trailing zeros, and no previous factorial, because the previous factorial is not printed in estimate mode. The trailing-zero counts and digit counts in this table are the calculator’s own displayed figures, and the counting method behind them is explained in the last section below, so you can verify 100! and 2,000! by hand without multiplying anything out.
Where factorials actually show up
The tip under the result panel says it in one line: n! counts the ways to arrange n different items in a row. So 5! = 120 means five books can be ordered on a shelf in 120 different ways, and the panel’s own tip for 10! puts it the same way: ten books have over three and a half million possible orders, which is 3,628,800. The base table gives the same ladder for smaller shelves: 8 distinct items have 8! = 40,320 orders, and 7 have 7! = 5,040. The rule is always the same: the first position can take any of the n items, the second any of the remaining n − 1, and so on down to 1, and multiplying those choices gives n!. If any of the items are identical rather than different, the count is smaller, and this calculator does not adjust for repeats — it counts arrangements of n different items, which is what its tip states.
Factorials are also the building blocks of the two counting formulas most readers meet next, and both can be checked against the combination calculator’s own displayed results. A combination, choosing k items out of n without caring about order, is C(n, k) = n! ÷ (k! × (n − k)!). For n = 10 and k = 3 that is 10! ÷ (3! × 7!) = 3,628,800 ÷ (6 × 5,040) = 120, which is the combination calculator’s displayed C(10, 3). A permutation, choosing k items out of n in order, is P(n, k) = n! ÷ (n − k)!: for the same numbers that is 3,628,800 ÷ 5,040 = 720, the combination calculator’s displayed P(10, 3). The difference between the two is exactly the k! orders of the chosen items: 720 ÷ 120 = 6, which is 3!, and that is why a factorial arranges all n items while a permutation arranges only k of them, as the base guide’s last question explains.
Beyond counting, factorials appear in probability and in calculus, in the places the base guide names. In probability, the binomial distribution — the chance of a given number of successes in repeated yes-or-no trials — is built from combinations, and therefore from factorials in its denominators. In calculus, the series for e to the power x and for sine are built from factorials in their denominators, term by term. And in everyday counting questions, the base guide’s example is the honest one: if you have ever asked how many different passwords can be made from a set of characters, a factorial was hiding in the answer, because each new character position multiplies the count by one more number. None of these uses needs the full printed value of a huge factorial: what matters is the count, the digit scale, and the recurrence, which is exactly what this calculator’s panel shows.
Inputs, limits, and the estimate mode
The input takes whole numbers from 0 up to 10,000, as the label under the box states, and the calculator only accepts whole numbers. Negative numbers and decimals have no factorial in this calculator: the base guide is explicit that factorials here are defined for whole numbers from 0 upward, and that mathematicians extend the idea to other numbers with the gamma function, which is a different tool and outside this calculator’s scope. In a probe of the page, typing a negative number did not produce a factorial result at all — the display kept the previous valid answer, 5! = 120 — so a negative or decimal entry is not silently reinterpreted as something else; it simply gives you no new factorial, and you should re-enter a whole number from 0 upward.
The exactness limit is 1,000!, and it is a display limit, not a math limit. Up to 1,000!, the exact answer is shown in full, and 1,000! has 2,568 digits, as the base guide states. Above 1,000, the full answer would be thousands of digits long and would bury the answer you actually need, so the calculator shows the exact digit count and a scientific-notation estimate instead, and says so plainly on the panel: 2,000! is shown as ≈ 3.316275e+5735, with 5,736 digits, and the panel states that 2,000! has 5,736 digits, too many to print in full. The trailing-zero count is still shown exactly in estimate mode — 499 for 2,000! — and the scientific notation is still given to six decimal places, so the estimate is useful for scale even though the full digit string is not printed. The previous-factorial line is blank in estimate mode, shown as a dash, just as it is blank for 0!, where there is no previous factorial to show.
The reason this calculator stays precise where phone calculators fail is the arithmetic it uses. Most phone calculators use ordinary floating-point numbers, which overflow around 170!, as the base guide explains, and that is why a phone calculator shows an error for large factorials. This calculator uses exact whole-number arithmetic (BigInt), so it stays precise far beyond that point: 100! is exact, 1,000! is exact, and even the 2,000! estimate carries an exact digit count and an exact trailing-zero count. The trade-off is only in display: above 1,000, you trade the full digit string for a count and an estimate, which is the right trade for a number with 5,736 digits.
Checking your answers without multiplying everything out
Two checks catch almost every factorial mistake, and both use only the panel’s own figures. The first is the recurrence: n! = n × (n − 1)!. The panel shows the previous factorial precisely so you can use it. For 10!, the panel shows 9! = 362,880, and 10 × 362,880 = 3,628,800, which is the displayed 10!. For 20!, the panel shows 19! = 121,645,100,408,832,000, and 20 × 121,645,100,408,832,000 = 2,432,902,008,176,640,000, which is the displayed 20!. If your hand multiplication disagrees with the panel, check the previous factorial first: a single wrong digit in (n − 1)! propagates to n! unchanged in form, and the recurrence tells you which of the two numbers is at fault.
The second check is the trailing-zero count, which you can compute from factors of 5 alone. A trailing zero needs a factor of 10, which needs a 2 and a 5 together, and in 1 through n there are always more 2s than 5s, so the trailing zeros equal the number of factors of 5 in 1 through n. Count the multiples of 5, then add the extra factors from multiples of 25, then 125, and so on. The base guide works 100! this way: 20 multiples of 5, plus 4 extra from multiples of 25, gives 24 trailing zeros, which is the panel’s displayed count for 100!. The same method gives 2,000!: 400 multiples of 5, plus 80 from multiples of 25, plus 16 from multiples of 125, plus 3 from multiples of 625, which is 400 + 80 + 16 + 3 = 499, matching the panel’s displayed 499 exactly. This arithmetic is shown here so you can verify the panel, not as a replacement for it: the panel’s figure is the authority, and the hand count is the check.
The digit counts tell the same growth story in miniature, and they are worth memorising as landmarks: 10! has 7 digits, 100! has 158, 1,000! has 2,568, and 2,000! has 5,736. Notice that the digit count roughly doubles when n doubles at the top end — 2,568 to 5,736 is more than double, because each new multiplier is itself a larger number — while at the bottom end it grows slowly, from 3 digits at 5! to 7 at 10! to 19 at 20!. If a factorial you compute by hand has far fewer digits than the landmark for its size, you have almost certainly dropped a multiplier somewhere in the middle of the chain, and the panel’s step-by-step multiplication, 10 × 9 × … × 1, shows you exactly where to look.
Small counting problems you can solve with the ladder
The ladder from 0! to 20! on the base page is not just a reference table — it is a set of answers to the most common small counting problems, and reading it that way makes the numbers memorable. One person can stand in one way, which is 1! = 1. Two distinct books can be ordered in 2 ways, which is 2! = 2. Four distinct letters can be arranged in 24 ways, which is 4! = 24. Six people finishing a race, with no ties, can cross the line in 720 possible orders, which is 6! = 720. Eight runners can finish in 40,320 possible orders, which is 8! = 40,320. Each of those figures is a base-table value, and each one is the same rule: the first position takes any of the n items, the second takes any of the remaining n − 1, and so on, and multiplying those choices gives n!.
The value of 0! = 1 shows up most clearly in combinations, where it is not a curiosity but a load-bearing definition. Choosing 0 items out of n, or choosing all n items out of n, should each be possible in exactly 1 way — there is one empty selection, and one full selection — and the combination formula gives exactly that, but only because 0! = 1: C(n, 0) = n! ÷ (0! × n!) = n! ÷ (1 × n!) = 1, and C(n, n) = n! ÷ (n! × 0!) = 1 the same way. If 0! were 0, both formulas would divide by zero and break; if 0! were anything else, the counts would be wrong. That is the deeper reason the base guide gives for the definition, beyond the empty-arrangement story: 0! = 1 is the value that keeps the counting formulas consistent at the edges, where n = 0 or k = 0, and not just in the middle where the answers are obvious.
Finally, factorials grow faster than the exponentials most readers use as their mental model of fast growth, and the comparison is worth making explicit with plain arithmetic. Two to the power 10 is 1,024, while 10! is 3,628,800 — the factorial is already more than three thousand times larger. Two to the power 20 is 1,048,576, while 20! is 2,432,902,008,176,640,000 — the factorial is now more than two trillion times larger. The reason is structural: an exponential multiplies by the same number at every step, while a factorial multiplies by a larger number at every step, so the gap widens at every step and never closes. When a counting problem surprises you with an enormous answer — a shuffled deck, a long password, a large tournament bracket — the surprise is usually this gap: you were imagining exponential growth, and the problem was factorial all along.
Beyond the ladder: 25!, the gamma boundary, and the multiplication chain
The base ladder stops at 20!, but the method does not, and one step past it is a useful landmark: 25! = 15,511,210,043,330,985,984,000,000, with 26 digits and 6 trailing zeros. The trailing zeros check out by the factors-of-5 method: 5 multiples of 5 up to 25, plus 1 extra from the multiple of 25 itself, gives 5 + 1 = 6, matching the value’s six trailing zeros. The digit count checks out the other way: 20! has 19 digits, and multiplying by 21, 22, 23, 24, and 25 adds roughly seven more digits, landing at 26. You do not need to take either check on trust — type 25 into the calculator and read the panel’s own figures, which will show the same value, the same digit count, and the same trailing-zero count, because the calculator’s exact arithmetic covers the whole range up to 1,000! in full.
The panel’s step-by-step multiplication chain is the feature that makes such checks possible, and it is worth using deliberately rather than glancing at the headline. For 7!, the chain is 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040, and the recurrence gives the same answer from the previous factorial: 6! = 720, and 7 × 720 = 5,040. For any n, the chain and the recurrence must agree, and if they do not, the disagreement locates the error: a chain that skips a multiplier, or repeats one, will disagree with the recurrence by exactly that multiplier’s factor. This is the same discipline as the trailing-zero check, applied to the value itself rather than to its tail: two independent routes to the same number, and a mismatch means one route has a slip, not that factorials are mysterious.
The boundary of this calculator is the boundary of whole numbers, and the base guide names what lies beyond it: the gamma function, which extends the factorial idea to non-integers. For whole numbers, the gamma function agrees with the factorial, shifted by one: gamma(n + 1) = n!, so gamma(6) = 5! = 120 and gamma(1) = 0! = 1. That agreement is why the gamma extension is the standard one, and it is also why this calculator does not offer it: a tool that computed gamma values would be answering a different question, with different inputs, and the whole-number panel — digit counts, trailing zeros, previous factorial, multiplication chains — would not apply to its answers. If you need a factorial of a fraction or a negative number, you need the gamma tool, not this one, and this page’s refusal to reinterpret such inputs as whole numbers is a feature, not a gap: it keeps the whole-number answers exact, which is the job this calculator was built for.
One more recurrence check ties the new landmark back to the panel: for 25!, the panel shows the previous factorial 24! = 620,448,401,733,239,439,360,000, and 25 times that figure is 15,511,210,043,330,985,984,000,000, which is the displayed 25!, with scientific notation 1.551121e+25. The chain, the recurrence, the digit count of 26, and the trailing-zero count of 6 all agree, and that four-way agreement is the standard to hold any factorial answer to, whether it comes from this page, from a textbook, or from your own hand.
Why 0! equals 1: the empty product
There is exactly one way to arrange zero items: the empty arrangement, with nothing in it. Counting arrangements gives 0! equals 1 for the same reason that counting the ways to choose nothing from a collection gives one way, the empty choice, and the same answer falls out of the recurrence that defines every other factorial. The recurrence says n! equals n times (n minus 1)!, and at n equals 1 it says 1! equals 1 times 0!, so since 1! is 1, 0! must be 1, or the recurrence breaks at its first step. Neither argument is a trick: the counting argument and the recurrence argument agree, and either one alone would settle the value, which is why mathematicians treat 0! equals 1 as a definition forced by the rest of the system, not as an arbitrary choice.
The name for the principle is the empty product: the product of no numbers at all is defined to be 1, the multiplicative identity, in the same way that the sum of no numbers is defined to be 0, the additive identity. The convention is what lets the factorial formulas keep working at the boundary: the number of ways to arrange n items taken 0 at a time, the binomial coefficient with 0 on the bottom, and the power-series terms that start at 0! all need the value 1 to give the answers counting already requires. A definition of 0! as 0 would break the recurrence, break the counting, and break every formula that reaches the boundary, while 1 breaks nothing, which is the test a convention has to pass. This calculator follows the same convention, as its first FAQ states, and the table in the next section shows the value sitting naturally at the start of the ladder, with 1! equal to 1 beside it.
The value table, 0! to 10!
Each row is built from the row above it by one multiplication, which is the recurrence in table form, and the table is worth reading as a growth story as much as a reference: the values stay small through 4!, pass 100 at 5!, pass a million at 10!, and the step from one row to the next multiplies by a larger number every time, so the growth accelerates without ever pausing.
| n | n! | Built as |
|---|---|---|
| 0 | 1 | Empty product, by definition |
| 1 | 1 | 1 times 0! |
| 2 | 2 | 2 times 1! |
| 3 | 6 | 3 times 2! |
| 4 | 24 | 4 times 3! |
| 5 | 120 | 5 times 4! |
| 6 | 720 | 6 times 5! |
| 7 | 5,040 | 7 times 6! |
| 8 | 40,320 | 8 times 7! |
| 9 | 362,880 | 9 times 8! |
| 10 | 3,628,800 | 10 times 9! |
Beyond the table, the same recurrence keeps going: 20! is 2,432,902,008,176,640,000, a 19-digit number, built as 20 times 19!, and the digit count and the trailing-zero count on this page are the checks that keep a long multiplication honest, with 20! carrying 4 trailing zeros, from the four factors of 5 in the numbers 1 through 20. The calculator on this page shows exact whole numbers up to 1,000! and estimates beyond that, and any value in the table can be verified by multiplying the chain out by hand, which is the point of printing the chain: a factorial is a multiplication, and the multiplication is the proof.
Factorials in Python: math.factorial and the loop
Python has a factorial built in, and writing the loop by hand is the fastest way to see what it does. The built-in call is import math followed by math.factorial(5), which returns 120, and math.factorial(0) returns 1, matching the empty-product convention in the first section above. A negative argument raises a ValueError, because factorials are not defined for negative whole numbers, and a decimal argument is likewise rejected, which matches this calculator, which accepts whole numbers from 0 upward. Python integers have arbitrary precision, so math.factorial stays exact far beyond the point where an ordinary calculator rounds, and the exactness is real, not displayed rounding: the full integer is computed, digit by digit.
The loop version is five lines and teaches the recurrence directly: start with result = 1, then for each i from 1 through n, set result = result * i, then return result. Starting the result at 1 is what makes the loop correct for 0, because with no multiplications to perform, the result stays 1, which is 0!, and the same starting value is why the loop and the built-in agree on every input. A loop that starts at 0, or that multiplies by 0 first, gives 0 for everything and has confused the sum with the product; a loop that starts at 1 and multiplies upward gives the table in the previous section, row by row, and the trailing-zero and digit counts on this page are the checks that the loop and the calculator agree.
Frequently asked questions
What is 0! and why is it 1?
0! = 1 by definition. There is exactly one way to arrange zero items, the empty arrangement, and defining it as 1 keeps the rule n! = n × (n − 1)! working for n = 1.
Can I find the factorial of a negative number or a decimal?
Not with this calculator. Factorials are defined for whole numbers from 0 upward. Mathematicians extend the idea to other numbers with the gamma function, but that is a different tool and outside this calculator’s scope.
What is the largest factorial this calculator shows exactly?
1,000! in full, which has 2,568 digits. Above 1,000, you get the exact digit count and a scientific-notation estimate, because printing thousands of digits would bury the answer you actually need.
Why does my phone calculator show an error for large factorials?
Most phone calculators use ordinary floating-point numbers, which overflow around 170!. This calculator uses exact whole-number arithmetic (BigInt), so it stays precise far beyond that point.
How many trailing zeros does 100! have?
100! has 24 trailing zeros. Trailing zeros come from factors of 10, which need a 2 and a 5 together. Count the factors of 5 in 1 through 100: 20 multiples of 5, plus 4 extra from multiples of 25, gives 24.
What is the difference between a factorial and a permutation?
A factorial n! arranges all n items. A permutation P(n, k) arranges only k of them, chosen in order, and equals n! divided by (n − k)!.
How many digits does 1,000! have?
1,000! has 2,568 digits, and it is the largest factorial this calculator prints in full. Above 1,000, you get the exact digit count and a scientific-notation estimate instead: 2,000! has 5,736 digits and is shown as ≈ 3.316275e+5735.
Why does the calculator stop printing the full number above 1,000?
Because the full answer would be thousands of digits long and would bury the answer you actually need. The calculator says so plainly on the panel — for 2,000! it states that the number has 5,736 digits, too many to print in full — and gives you the digit count, the trailing-zero count (499), and the estimate ≈ 3.316275e+5735 instead.
What does “previous factorial” show, and why is it sometimes blank?
It shows (n − 1)!, so you can check the recurrence n! = n × (n − 1)!: for 10! it shows 9! = 362,880, and 10 × 362,880 = 3,628,800. It is blank, shown as a dash, for 0!, because there is no (−1)!, and in estimate mode above 1,000, because the previous factorial is not printed there either.
How can I count trailing zeros without multiplying everything out?
Count the factors of 5 in 1 through n: multiples of 5, plus extra factors from multiples of 25, 125, and so on. For 100! that is 20 + 4 = 24 trailing zeros, and for 2,000! it is 400 + 80 + 16 + 3 = 499, matching the calculator’s displayed counts exactly.
What is an empty product?
The product of no numbers at all, defined to be 1, the multiplicative identity, just as the sum of no numbers is defined to be 0. It is the reason 0! equals 1: the factorial of zero is the product of an empty list of factors, and defining it as 1 keeps the recurrence n! equals n times (n minus 1)! working at n equals 1, and keeps the counting formulas working at the boundary.
How do I calculate a factorial in Python without math.factorial?
Start with result equal to 1, then multiply by each whole number from 1 through n in turn, and return the result. Starting at 1 is what makes the loop correct for 0, where no multiplications happen and the answer stays 1. The loop gives the same values as math.factorial, and Python integers stay exact for large n.
What is 20! ?
2,432,902,008,176,640,000, a 19-digit number built as 20 times 19!. It carries 4 trailing zeros, from the four factors of 5 in the numbers 1 through 20. It is exact whole-number arithmetic, the same kind this calculator shows up to 1,000!, and it can be checked by multiplying the chain out from the value table.