Factorial Calculator
Calculate n! exactly, with the step-by-step multiplication, digit count, trailing zeros and scientific notation.
- Digits
- 7
- Scientific notation
- 3.6288 × 10⁶
- Exact
- Trailing zeros
- 2
- Factors multiplied
- 10
- 10 × … × 1
Step-by-step calculation
Step 1: Write out the product
n! multiplies every whole number from 10 down to 1: 10 factors in all.
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
Step 2: Multiply from left to right
10 × 9 = 90
90 × 8 = 720
720 × 7 = 5,040
5,040 × 6 = 30,240
30,240 × 5 = 151,200
151,200 × 4 = 604,800
604,800 × 3 = 1,814,400
1,814,400 × 2 = 3,628,800
Step 3: Count the digits
3,628,800 has 7 digits.
Digits = 7
Step 4: Count the trailing zeros
Every trailing zero comes from a factor 10 = 2 × 5. There are more 2s than 5s among 1…n, so count the factors of 5: multiples of 5 give one each, multiples of 25 one more, and so on.
⌊10 / 5⌋ = 2
Trailing zeros = 2
Factorial formula
n! = n × (n − 1) × … × 2 × 1
0! = 1
n! = n × (n − 1)!
Counting formulas that use factorials
| Formula | Counts |
|---|---|
| n! | Orders of all n items (5 books on a shelf: 5! = 120) |
| nPr = n! / (n − r)! | Ordered picks of r from n (gold, silver, bronze from 8 runners: 336) |
| nCr = n! / (r!(n − r)!) | Groups of r from n, order ignored (3 of 8 people for a committee: 56) |
Factorial table
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5,040 |
| 8 | 40,320 |
| 9 | 362,880 |
| 10 | 3,628,800 |
| 11 | 39,916,800 |
| 12 | 479,001,600 |
Factorials are computed with exact whole-number arithmetic, never rounded floating point. To count ordered or unordered selections, use the Permutation Calculator or the Combination Calculator; to turn a count into a chance, the Probability Calculator. Factorials also give the coefficients in the Binomial Expansion Calculator. To see which primes make up n!, try the Prime Factorization Calculator, and for writing huge results compactly, the Scientific Notation Calculator.
A factorial multiplies a whole number by every whole number below it, down to 1: 5! = 5 × 4 × 3 × 2 × 1 = 120. This factorial calculator finds n! exactly for any non-negative whole number up to 10,000 and shows how the answer is built, so you can check homework as well as get the number.
Enter n to see n! together with its number of digits, scientific notation, trailing zeros and a step-by-step calculation. Large results such as 100!, which has 158 digits, are shown in full in a scrollable box, and scientific notation gives their size at a glance.
Worked Calculation Examples
| Scenario | Result | Calculation Step |
|---|---|---|
| 5 factorial | 120 | 5! = 5 × 4 × 3 × 2 × 1 = 120: 3 digits, 1 trailing zero (one factor of 5). |
| 10 factorial | 3,628,800 | 10! = 10 × 9 × … × 2 × 1 = 3,628,800: 7 digits, 3.6288 × 10⁶, and 2 trailing zeros from the factors 5 and 10. |
| 0 factorial | 1 | 0! = 1. There are no factors to multiply, and the empty product is 1; it also follows from 1! = 1 × 0!. |
| 20 factorial | 2,432,902,008,176,640,000 | 20! = 20 × 19 × … × 2 × 1 = 2,432,902,008,176,640,000, a 19-digit number (≈ 2.43 × 10¹⁸) with 4 trailing zeros. It is about 670 billion times 10!, because the ten extra factors 11 to 20 are all multiplied in. |
| 100 factorial | ≈ 9.332621544 × 10¹⁵⁷ | 100! has 158 digits, so its size is clearest in scientific notation: about 9.332621544 × 10¹⁵⁷. It ends in floor(100/5) + floor(100/25) = 20 + 4 = 24 zeros. The calculator shows all 158 digits exactly in a scrollable box. |
What Is a Factorial?
The factorial of a non-negative whole number n, written n!, is the product of all positive whole numbers from 1 to n:
n! = n × (n − 1) × (n − 2) × … × 2 × 1
So 4! = 4 × 3 × 2 × 1 = 24 and 6! = 720. In the ordinary definition, factorials exist only for 0, 1, 2, 3 and so on. Negative numbers have no factorial, and decimals such as 4.5 need an extension called the gamma function, which this calculator does not compute.
How to Calculate a Factorial
1. Write down n.
2. Multiply it by n − 1, then by n − 2, and keep going down to 1.
3. The final product is n!.
For 5!: 5 × 4 = 20, 20 × 3 = 60, 60 × 2 = 120, and 120 × 1 = 120. If you already know (n − 1)!, one multiplication is enough, because n! = n × (n − 1)!: knowing 9! = 362,880 gives 10! = 10 × 362,880 = 3,628,800.
Why Is 0! Equal to 1?
It is not an arbitrary rule; two simple arguments give the same answer.
The recursive relationship: n! = n × (n − 1)!, so (n − 1)! = n! ÷ n. Going down one step at a time: 3! = 4! ÷ 4 = 6, 2! = 3! ÷ 3 = 2, 1! = 2! ÷ 2 = 1, and 0! = 1! ÷ 1 = 1.
The empty product: 0! multiplies no numbers at all. Adding nothing gives 0, the starting point for sums; multiplying nothing gives 1, the starting point for products. Counting agrees too: n! is the number of ways to arrange n objects, and there is exactly one way to arrange zero objects, the empty arrangement. That is why formulas such as nCr = n! / (r!(n − r)!) work when r = 0 or r = n.
Why Do Factorials Grow So Quickly?
Each step multiplies by a larger number instead of adding one. 5! = 120, 10! = 3,628,800, and 20! = 2,432,902,008,176,640,000, already more than 2 quintillion. Going from 10! to 20! multiplies by 11 × 12 × … × 20, which is about 670 billion.
Factorials outgrow any exponential function: from n = 25 onwards n! is larger than 10ⁿ. 70! is the first factorial above a googol (10¹⁰⁰), 100! has 158 digits, and 1,000! has 2,568. Ordinary calculators and spreadsheets use floating-point numbers, which stop being exact after 22! (they hold about 16 significant digits) and overflow to infinity at 171!, so this calculator uses exact whole-number arithmetic instead.
Trailing Zeros in a Factorial
A trailing zero comes from a factor of 10, and 10 = 2 × 5. Among the numbers 1 to n there are far more even numbers than multiples of 5, so the number of 5s decides how many 10s can be formed. Count them with
floor(n/5) + floor(n/25) + floor(n/125) + …
Every multiple of 5 gives one 5, every multiple of 25 gives an extra one, and so on. For 100!: floor(100/5) = 20 and floor(100/25) = 4, so 100! ends in 24 zeros. For 10!: floor(10/5) = 2, and indeed 10! = 3,628,800 ends in two zeros.
Number of Digits in a Factorial
5! = 120 has 3 digits, 10! = 3,628,800 has 7, and 100! has 158. For a positive number x, the digit count is floor(log₁₀ x) + 1, and log₁₀(n!) = log₁₀ 1 + log₁₀ 2 + … + log₁₀ n. For very large n, Stirling's approximation, n! ≈ √(2πn) (n/e)ⁿ, gives this sum without multiplying anything, which is how the calculator finds that 1,000,000! has 5,565,709 digits.
Where Are Factorials Used?
Counting arrangements: 5 different books can be put on a shelf in 5! = 120 orders; a deck of 52 cards can be shuffled into 52! ≈ 8.07 × 10⁶⁷ orders.
Permutations and combinations: nPr = n! / (n − r)! counts ordered selections and nCr = n! / (r!(n − r)!) counts unordered ones, the binomial coefficients in (a + b)ⁿ.
Probability: the chance that 5 shuffled books land in alphabetical order is 1 / 5! = 1/120.
Series and discrete mathematics: factorials appear in the Taylor series eˣ = 1 + x + x²/2! + x³/3! + …, in Stirling's approximation, in counting problems throughout combinatorics, and in the running time of brute-force algorithms that try every ordering.
Factorial vs Permutation vs Combination
Use a factorial, n!, when you arrange all n items: seating 6 people in a row gives 6! = 720 orders.
Use a permutation, nPr = n! / (n − r)!, when you pick r of the n items and their order matters: gold, silver and bronze among 8 runners gives 8P3 = 8 × 7 × 6 = 336.
Use a combination, nCr = n! / (r!(n − r)!), when you pick r items and order does not matter: a committee of 3 from 8 people gives 8C3 = 336 ÷ 3! = 56. A factorial is the special case nPn = n!.
How to Use the Factorial Calculator
- Enter n, a non-negative whole number such as 10. Results update as you type.
- Read n! in the result card, together with its number of digits, scientific notation, trailing zeros and the number of factors multiplied.
- Follow the step-by-step calculation: the product written out, the multiplication, the digit count and the trailing-zero count.
- For long results, copy the exact integer from the result box, or use the scientific notation when you only need the size.
- Values above 10,000! are too long to write out, so the calculator gives the exact digit count and trailing zeros with approximate leading digits, up to n = 1,000,000.
Frequently Asked Questions
What is a factorial?
The factorial of a non-negative whole number n, written n!, is the product of every whole number from n down to 1. For example, 4! = 4 × 3 × 2 × 1 = 24.
How do you calculate a factorial?
Multiply n by every whole number below it down to 1. For 5!: 5 × 4 = 20, 20 × 3 = 60, 60 × 2 = 120, 120 × 1 = 120. If you know (n − 1)!, just multiply it by n.
What is 0!?
0! = 1. It is the empty product (multiplying no numbers gives 1), it is the only value that keeps 1! = 1 × 0! true, and there is exactly one way to arrange zero objects.
What is 5 factorial?
5! = 5 × 4 × 3 × 2 × 1 = 120.
What is 10 factorial?
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800.
What is 20 factorial?
20! = 2,432,902,008,176,640,000, about 2.43 × 10¹⁸. It is the largest factorial that fits in a signed 64-bit integer.
Why do factorials get so large?
Each step multiplies by a bigger number rather than adding one, so the growth accelerates: 5! = 120, 10! = 3,628,800 and 20! is over 2 quintillion. From n = 25 onwards, n! is bigger than 10ⁿ.
How many digits does 100! have?
158. 100! ≈ 9.332621544 × 10¹⁵⁷, and a number between 10¹⁵⁷ and 10¹⁵⁸ has 158 digits.
How are trailing zeros in a factorial calculated?
Count the factors of 5, since each pairs with one of the more plentiful factors of 2 to make a 10: floor(n/5) + floor(n/25) + floor(n/125) + …. For 100!, that is 20 + 4 = 24 trailing zeros.
What is the difference between factorial and permutation?
n! counts the orders of all n items. A permutation nPr = n! / (n − r)! counts the orders of only r items chosen from n. For example, 5! = 120 arranges 5 books, while 5P2 = 20 arranges 2 of them.
Can factorials be calculated for decimal numbers?
Not with the ordinary definition, which only covers non-negative whole numbers, and this calculator rejects decimals instead of rounding them. The gamma function extends factorials to decimals, with Γ(n + 1) = n!; for example, 0.5! = Γ(1.5) = √π / 2 ≈ 0.8862.
What is the largest factorial this calculator can find?
It writes n! out exactly up to 10,000!, which has 35,660 digits. Up to 1,000,000! it gives the exact number of digits and trailing zeros, with the leading digits approximated by Stirling’s formula and labelled as approximate.
Related Calculators
Permutation Calculator
Calculate permutations (nPr) with exact results and step-by-step working, with or without repetition.
Combination Calculator
Calculate combinations (nCr), the number of ways to choose r items from n when order does not matter, with exact results and step-by-step working.
Probability Calculator
Calculate simple probability from favorable and total outcomes, as a percentage, decimal, and simplified fraction, with the complement and step-by-step working.
Binomial Expansion Calculator
Expand (a + b)ⁿ step by step with the Binomial Theorem, find any term or coefficient, calculate C(n, k), and explore Pascal's Triangle.
Prime Factorization Calculator
Find the prime factors of a number with step-by-step division, exponent form, a factor tree, factor pairs and a check of the answer.
Scientific Notation Calculator
Convert numbers to and from scientific and engineering notation, add, subtract, multiply and divide in scientific notation, and round to significant figures, with steps.
Last updated: September 27, 2026.