Factorial Calculator

Calculate the factorial of any non-negative integer (n!). See step-by-step multiplication and related values.

Non-negative integer (0-170)
Second value for comparison
10!
3,628,800
Product of 1 through 10
Number of Digits
7
10! is a 7-digit number
Trailing Zeros
2
Determined by factors of 5: floor(10/5^k)
Stirling's Approx
3.598696e+6
sqrt(2*pi*n)*(n/e)^n -- error: 0.8296%
(10-1)!
362,880
10! / 10 = 3.6288e+5
(10+1)!
39,916,800
10! * 11
n!!
3,840
Double factorial: product of same-parity ints
!10 (Derangements)
1,334,961
Permutations where no element stays in place
Step-by-step expansion:
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800
Digit Magnitude
7 digits (vs 158 for 100!)
Comparison: 10! vs 12!
10! = 3.6288e+6
12! = 4.7900e+8
Ratio: 10! / 12! = 7.5758e-3
Factorial Reference Table
nn!DigitsTrailing 0s
0110
1110
2210
3610
42420
512031
672031
75,04041
840,32051
9362,88061
103,628,80072
1139,916,80082
12479,001,60092
136,227,020,800102
1487,178,291,200112
151,307,674,368,000133
1620,922,789,888,000143
17355,687,428,096,000153
186,402,373,705,728,000163
19121,645,100,408,832,000183
202,432,902,008,176,640,000194
Growth Visualization (log10 scale)
1!
1 digits
5!
3 digits
10!
7 digits
15!
13 digits
20!
19 digits
25!
26 digits
50!
65 digits
100!
158 digits
Planning notes, formulas, and examples

About the Factorial Calculator

The Factorial Calculator computes n! (n factorial) for any non-negative integer. The factorial of n is the product of all positive integers from 1 to n: n! = n × (n−1) × ... × 2 × 1.

Factorials grow extremely fast. While 10! = 3,628,800, by 20! the result exceeds 2.4 quintillion. Despite this explosive growth, factorials are fundamental — they appear in permutations, combinations, probability distributions, Taylor series, and countless mathematical formulas.

This calculator handles values up to 170! (the limit of JavaScript's floating-point precision) and shows the number of trailing zeros, which is determined by the number of times 5 divides into n!.

When This Page Helps

Factorials grow astronomically fast and are tedious to compute by hand. This calculator provides exact results (up to floating-point limits) and shows step-by-step multiplication.

How to Use the Inputs

  1. Enter a non-negative integer.
  2. View n! (the factorial).
  3. See the number of digits and trailing zeros.
  4. Compare with (n−1)! and (n+1)! for context.
  5. Results are exact up to 170! (JavaScript limit).
Formula used
n! = n × (n−1) × (n−2) × ... × 2 × 1 0! = 1 (by definition) Trailing zeros = Σ floor(n/5^k) for k = 1, 2, ..

Example Calculation

Result: 3,628,800

10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800. It has 7 digits and 2 trailing zeros.

Tips & Best Practices

  • 0! = 1 by mathematical convention (the empty product).
  • n! grows faster than any exponential function.
  • Stirling's approximation: n! ≈ √(2πn) × (n/e)^n for large n.
  • Trailing zeros come from factors of 10 = 2×5; count factors of 5.
  • JavaScript can represent up to 170! before reaching Infinity.
  • The gamma function extends factorials to non-integers: Γ(n) = (n−1)!.

Factorial in Combinatorics

The number of permutations of n objects is n!. Combinations use factorials: C(n,r) = n!/(r!(n−r)!). Many probability distributions (binomial, Poisson) involve factorials.

Stirling's Approximation

For large n, n! ≈ √(2πn)(n/e)^n. This approximation is remarkably accurate even for moderate n and is essential in statistical mechanics and information theory.

Computational Considerations

For exact results beyond 170!, arbitrary-precision arithmetic (BigInt) is needed. Many programming languages provide big-integer libraries specifically for factorial-related computations.

Mastering this concept provides a strong foundation for advanced coursework in mathematics, statistics, and related quantitative disciplines. Understanding when and how to apply factorials is essential for solving real-world problems in probability and combinatorics.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • n! (read "n factorial") is the product of all positive integers up to n. For example, 5! = 120. It counts the number of ways to arrange n distinct items in order.