Calculate n! (n factorial) for any non-negative integer — with the log of n! for handling large numbers.
The Factorial Calculator computes n! (n factorial) — the product of all positive integers from 1 to n. Factorials are fundamental in combinatorics, probability, statistics, and algebra. They appear in permutation and combination formulas, binomial theorem, Taylor series, and many areas of advanced mathematics.
What is a Factorial?
n! = n × (n−1) × (n−2) × ... × 2 × 1
For example: 5! = 5 × 4 × 3 × 2 × 1 = 120
Special Cases
0! = 1 (by mathematical convention — it represents the number of ways to arrange zero items: exactly 1 way, doing nothing)
1! = 1, 2! = 2, 3! = 6, 4! = 24, 5! = 120, 10! = 3,628,800, 20! = 2,432,902,008,176,640,000
Growth Rate
Factorials grow extremely rapidly. 70! has 100 digits! For n > ~18, JavaScript's standard number loses precision. For large n, the calculator shows the log₁₀ of n! which is more useful — it tells you how many digits the factorial has (floor of log₁₀(n!) + 1).
Applications
- Permutations: How many ways to arrange n objects = n!
- Combinations: nCr = n! / (r! × (n−r)!)
- Probability: Card dealing, lottery odds
- Statistics: Normal distribution, z-scores
1. Enter n: A non-negative integer (0–170). Above 170, JavaScript's number overflows.
2. View Results: See n! (exact for n ≤ 18, approximate for larger n) and log₁₀(n!) which tells you how many digits the factorial has.
n! = n × (n−1) × (n−2) × ... × 2 × 1
0! = 1 (by definition)
log₁₀(n!) = log₁₀(1) + log₁₀(2) + ... + log₁₀(n) = Σ log₁₀(k) for k=1 to n
Number of digits in n! = floor(log₁₀(n!)) + 1
For example: log₁₀(100!) ≈ 157.97, so 100! has 158 digits.
5! = 120, 10! = 3,628,800, 20! = 2,432,902,008,176,640,000
log₁₀(100!) ≈ 157.97 → 100! has 158 digits
log₁₀(1000!) ≈ 2567.6 → 1000! has 2,568 digits