Use this guide to understand and compute factorials. See the definition of n!, a quick reference table, fast methods for large factorials (scientific notation & Stirling’s approximation), how to find trailing zeros in n!, and how factorials power permutations and combinations.
For a non-negative integer n, the factorial n! is the product of all positive integers up to n:
0! = 1 (by definition)
1! = 1
n! = n × (n−1) × (n−2) × … × 2 × 1 for n ≥ 1
Examples:
3! = 3×2×1 = 6 ·· 5! = 5×4×3×2×1 = 120
Start at n and multiply downwards by each whole number.
Stop at 1.
If n = 0, return 1.
Tip: Factorials grow very quickly. Even 20! is a 19-digit number.
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
13! = 6,227,020,800
14! = 87,178,291,200
15! = 1,307,674,368,000
16! = 20,922,789,888,000
17! = 355,687,428,096,000
18! = 6,402,373,705,728,000
19! = 121,645,100,408,832,000
20! = 2,432,902,008,176,640,000
Because n! explodes in size, we often present big results as mantissa × 10^exponent.
Digits in n! (Kamenetsky/Stirling-based):
digits ≈ ⌊ n·log₁₀(n/e) + 0.5·log₁₀(2πn) ⌋ + 1
(Accurate for n ≥ 3; use 1 digit for n = 0 or 1.)
Stirling’s approximation (natural log form):
ln(n!) ≈ n·ln n − n + ½·ln(2πn)
Then: n! ≈ e^{ln(n!)} ≈ m × 10^k with
k = ⌊ ln(n!) / ln 10 ⌋ and m = 10^{ ln(n!)/ln 10 − k }.
These give reliable scientific-notation estimates (e.g., 100! ≈ 9.3326 × 10^157).
The number of trailing zeros in n! equals the number of times 10 divides n!, which is limited by the number of factor 5s (since 2s are plentiful):
zeros(n!) = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ⋯
Examples:
zeros(10!) = ⌊10/5⌋ = 2
zeros(100!) = ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24
Permutations (order matters):
P(n, r) = n! / (n−r)!
Combinations (order doesn’t matter):
C(n, r) = n! / (r! · (n−r)!)
Examples:
P(10, 3) = 10! / 7! = 720
C(10, 3) = 10! / (3!·7!) = 120
Q: What is 0! and why is it 1?
Defining 0! = 1 keeps combinatorics identities (like C(n, 0) = 1) and recurrence relations consistent.
Q: How big does n! get?
Very fast. 50! has 65 digits; 100! has 158 digits. Use scientific notation and logs for large n.
Q: Can I compute factorials for non-integers?
Yes, via the Gamma function: Γ(z) generalises factorial with n! = Γ(n+1) for integers n ≥ 0. Most calculators stick to integers for simplicity.
Q: How do I find trailing zeros without computing n!?
Use the factor-of-5 formula above—no huge products required.
Q: What’s the fastest way to estimate n!?
Use Stirling’s approximation for ln(n!), then convert to scientific notation.
Q: Why does my calculator show “Infinity” for big n?
Standard floating-point overflows. Use big-integer arithmetic (exact) or logarithms/approximations (estimate).
Was this calculator helpful?
Rate your experience to help us improve.
Thanks for rating! See the average and total ratings above.
Not rated yet—be the first to rate this calculator.