Factorial Calculator — Compute n! Step by Step (Free)

Fractions & numbersFreeNo sign-up

A factorial calculator multiplies every whole number from 1 up to n: n! = n × (n − 1) × … × 2 × 1. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120, and 10! = 3,628,800. Enter any n below for the exact value with every digit, the digit count, trailing zeros and the steps.

Factorial calculator
Exact value with every digit for n up to 50,000. Up to n = 1,000,000,000 you get the digit count, trailing zeros and scientific notation.
Try:
10!
3,628,800

10! = 3,628,800, the product of every whole number from 1 to 10. It has 7 digits and ends in 2 zeros.
Number of digits7
Trailing zeros2
Scientific notation3.6288 × 10⁶
Stirling approximation3,598,700
Stirling error0.83% too low
log₁₀(10!)6.559763033
Show steps
  1. Definition: n! = n × (n − 1) × … × 2 × 1, and 0! = 1 (there is exactly one way to arrange nothing).
  2. 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800.
  3. Build it up with n! = n × (n − 1)!: 5! = 120, 6! = 720, 7! = 5,040, 8! = 40,320, 9! = 362,880, 10! = 3,628,800.
  4. Digits: the number of digits is ⌊log₁₀(n!)⌋ + 1 = ⌊6.559763⌋ + 1 = 7.
  5. Trailing zeros (Legendre’s formula): each zero needs a 10 = 2 × 5, and 5s are rarer than 2s, so count the factors of 5: ⌊10/5⌋ = 2. Total = 2.
  6. Stirling’s formula: n! ≈ √(2πn) × (n/e)ⁿ = 3,598,700. It is about 0.83% too low (roughly 1/(12n)), and the relative error shrinks as n grows.
Prime factorization of 10!
28 × 34 × 52 × 7
Legendre’s formula gives the exponent of each prime p: ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + … The exponent of 5 equals the number of trailing zeros.
Stirling vs exact
n n! Stirling Error
1 1 0.922137 7.79%
2 2 1.919 4.05%
5 120 118.019 1.65%
10 3,628,800 3,598,700 0.83%
20 2.432902 × 10¹⁸ 2.42279 × 10¹⁸ 0.416%
50 3.0414093 × 10⁶⁴ 3.03634 × 10⁶⁴ 0.167%
100 9.3326215 × 10¹⁵⁷ 9.32485 × 10¹⁵⁷ 0.0833%

Factorial Calculator — Compute n! Step by Step (Free)
Embed this calculator on your site

Free to use on class pages, blogs and course pages. Copy the code below and paste it into your page:

How to use the factorial calculator

  1. Choose a mode: n! for an ordinary factorial, n!! for a double factorial, n! / k! to cancel two factorials, or x! decimals for non-integers such as 0.5!.
  2. Type the number. Whole-number factorials are exact up to n = 50,000 (213,237 digits); up to one billion you still get the digit count, trailing zeros and the leading digits.
  3. Read the answer, then open Show steps, the full list of digits, the prime factorization of n! and the Stirling comparison table.

What is a factorial?

The factorial of a whole number n, written n!, is the product of all whole numbers from 1 to n. It counts the ways to arrange n different objects in a row: 3 books can be ordered in 3! = 6 ways. Factorials grow very fast, because each one is the previous one times the next number:

n! = n × (n − 1)!, with 0! = 1.

So 6! = 720 gives 7! = 7 × 720 = 5,040 and 8! = 8 × 5,040 = 40,320. Setting 0! = 1 keeps this rule working (1! = 1 × 0!) and matches the fact that there is exactly one way to arrange nothing.

Factorial table from 0! to 15!

n n! n n!
0 1 8 40,320
1 1 9 362,880
2 2 10 3,628,800
3 6 11 39,916,800
4 24 12 479,001,600
5 120 13 6,227,020,800
6 720 14 87,178,291,200
7 5,040 15 1,307,674,368,000

Trailing zeros of n! (Legendre’s formula)

Every trailing zero comes from a factor 10 = 2 × 5. A factorial has far more factors of 2 than of 5, so the number of trailing zeros equals the number of factors of 5:

zeros(n!) = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …

For 100!: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24 zeros. For 1000!: 200 + 40 + 8 + 1 = 249 zeros. The same counting gives the exponent of any prime p in n!, which is how the calculator writes the prime factorization of n!.

How many digits does n! have?

The number of digits of a positive whole number N is ⌊log10 N⌋ + 1. Since log10(n!) = log10 1 + log10 2 + … + log10 n, the digit count follows without computing n! itself. For 100!, log10(100!) ≈ 157.97, so 100! has 158 digits.

Stirling’s approximation

For large n, n! ≈ √(2πn) · (n/e)n. The approximation is always a little low, by about 1/(12n) as a fraction: 0.83% at n = 10, 0.083% at n = 100 and 0.0083% at n = 1,000. The calculator shows Stirling’s value and its error next to the exact answer, so you can see the error shrink as n grows.

Double factorial, n! / k! and factorials of decimals

  • Double factorial: n!! multiplies every second number, so 9!! = 9 × 7 × 5 × 3 × 1 = 945 and 10!! = 10 × 8 × 6 × 4 × 2 = 3,840. For even n = 2k, n!! = 2k · k!. It is not the same as (n!)!.
  • Cancelling factorials: 10! / 8! = 10 × 9 × 8! / 8! = 90. Combinations use the same idea: C(6, 2) = 6! / (2! · 4!) = 720 / 48 = 15.
  • Decimals: the gamma function extends factorials to non-integers with x! = Γ(x + 1). Then 0.5! = √π/2 ≈ 0.886227 and 2.5! = 15√π/8 ≈ 3.323351. Negative whole numbers such as (−3)! are undefined.

Common mistakes with factorials

Mistake Correct version
Thinking 0! = 0 0! = 1 by definition.
Computing 10! / 8! as (10/8)! Factorials do not divide that way: 10! / 8! = 10 × 9 = 90.
Reading 2n! as (2n)! 2n! means 2 × n!. With n = 3, 2n! = 2 × 3! = 12, while (2n)! = 6! = 720.
Treating n!! as (n!)! n!! skips every second factor: 6!! = 48, while (6!)! = 720! is enormous.
Trusting a calculator’s 70! overflow Many calculators stop at 69! or 170!; use exact arithmetic or logarithms beyond that.

To check homework, cancel common factors by hand first and estimate the size with the digit count. Then compare each step with the calculator’s working.

Factorial practice quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. What is 6!?

Found a mistake? Let us know!

2. What is 0!?

Found a mistake? Let us know!

3. Simplify 12! / 10!.

Found a mistake? Let us know!

4. How many trailing zeros does 50! have?

Found a mistake? Let us know!

5. In how many ways can 4 different books be arranged on a shelf?

Found a mistake? Let us know!

6. What is 7!!?

Found a mistake? Let us know!

7. Given 8! = 40,320, what is 9!?

Found a mistake? Let us know!

8. How many digits does 20! have?

Found a mistake? Let us know!

9. Using the gamma function, what is 0.5! (to 3 decimal places)?

Found a mistake? Let us know!

10. What is C(7, 3) = 7! / (3! × 4!)?

Found a mistake? Let us know!

Frequently asked questions

What is factorial 100?

100! is about 9.3326 × 10157. It has 158 digits and ends in 24 zeros. Enter 100 above to see all 158 digits.

What is 1000 factorial?

1000! is about 4.0239 × 102567. It has 2,568 digits, and 249 of them are trailing zeros.

How do you calculate factorial quickly?

Use n! = n × (n − 1)! and build from a value you know. If you remember 6! = 720, then 7! = 5,040 and 8! = 40,320. Memorizing 1, 2, 6, 24, 120 and 720 covers most textbook problems.

What is 5 factorial?

5! = 5 × 4 × 3 × 2 × 1 = 120. It is the number of ways to arrange 5 different objects in a row.

Where is the factorial button on a calculator?

It is usually labelled x! or n!. On many Casio models it is a second function of the x−1 key; on TI graphing calculators it is in the MATH menu under PROB. Most handheld calculators overflow after 69!, which is why exact tools are useful for larger n.

How do you calculate factorial without a calculator?

Multiply step by step, and in fractions cancel before multiplying. For example, 10! ÷ 8! = 10 × 9 = 90, and 7! / (3! · 4!) = (7 × 6 × 5) / (3 × 2 × 1) = 35.

Related calculators

More fractions & numbers calculators

Browse all 206 calculators

Related to This Article

What people say about "Factorial Calculator: Exact n!, Digits, Zeros & Steps"?

No one replied yet.

Leave a Reply