Math

Factorial Calculator (n!) with Reference Table

Calculator Free · Private
Reviewed by: (política editorial ) · Last reviewed:
Was this calculator helpful?

The factorial of n, written n!, is the product of every positive integer from 1 up to n. It answers the question: In how many ways can n distinct objects be arranged in order? For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow explosively fast — 20! already exceeds 2.4 quintillion — making this calculator essential for combinatorics, probability, statistics, and computer science problems where exact large-integer results matter.

Last reviewed: June 3, 2026 Verified by Source: NIST Digital Library of Mathematical Functions — Gamma Function and Factorials (§5.1–5.2), Wikipedia — Factorial (mathematics) 100% private

The factorial of n (written n!) is the product of all positive integers from 1 to n: n! = 1 × 2 × 3 × … × n. Key values: 0! = 1, 5! = 120, 10! = 3,628,800, 20! = 2,432,902,008,176,640,000. Factorial counts the number of distinct ways to arrange n objects in order.

When to use this calculator

  • Counting the number of ways to arrange 8 competitors on a podium: 8! = 40,320 possible orderings.
  • Calculating permutations of a 13-card hand dealt from a shuffled deck using 52! / 39!.
  • Computing binomial coefficients C(n, k) = n! / (k! × (n−k)!) needed for probability distributions and statistical tests.
  • Determining the number of unique routes a delivery driver can take visiting 10 stops: (10−1)! = 362,880 circular permutations.
  • Evaluating Taylor/Maclaurin series terms such as e^x = Σ (x^n / n!) in calculus and physics simulations.
  • Checking hash collision probabilities using the birthday problem approximation involving k! terms.

Example: 6!

  1. n = 6
  2. 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720
Result: 6! = 720

How it works

3 min read

How It Is Calculated

The factorial function is defined both recursively and iteratively:

Iterative:  n! = 1 × 2 × 3 × … × n
Recursive:  n! = n × (n−1)!  (base case: 0! = 1)

Stirling's Approximation (large n):
  n! ≈ √(2πn) × (n/e)^n
  where e ≈ 2.71828

The convention 0! = 1 ensures combinatorial formulas remain consistent when k = 0 or k = n.

---

Reference Table: Factorial Values 0 to 20

nn!Scientific notationDigits
011 × 10⁰1
111 × 10⁰1
222 × 10⁰1
366 × 10⁰1
4242.4 × 10¹2
51201.2 × 10²3
67207.2 × 10²3
75,0405.04 × 10³4
840,3204.032 × 10⁴5
9362,8803.629 × 10⁵6
103,628,8003.629 × 10⁶7
1139,916,8003.992 × 10⁷8
12479,001,6004.79 × 10⁸9
136,227,020,8006.227 × 10⁹10
1487,178,291,2008.718 × 10¹⁰11
151,307,674,368,0001.308 × 10¹²13
1620,922,789,888,0002.092 × 10¹³14
17355,687,428,096,0003.557 × 10¹⁴15
186,402,373,705,728,0006.402 × 10¹⁵16
19121,645,100,408,832,0001.216 × 10¹⁷18
202,432,902,008,176,640,0002.433 × 10¹⁸19

---

Large Factorial Quick Reference

nn! (approx.)Digits
251.551 × 10²⁵26
503.041 × 10⁶⁴65
1009.333 × 10¹⁵⁷158
1707.257 × 10³⁰⁶307
171overflowexceeds double-precision floating point

> Number of digits in n! ≈ n·log₁₀(n/e) + ½·log₁₀(2πn) — for n = 1,000 that is 2,568 digits.

---

Worked Examples

Permutations — arranging a playlist of 7 songs in every possible order:
7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040 unique orderings.

Combinations — choosing a 5-person committee from 10 candidates:
C(10, 5) = 10! / (5! × 5!) = 3,628,800 / (120 × 120) = 252 distinct committees.

Probability — how unique is a shuffled deck of 52 cards?
Total distinct orderings: 52! ≈ 8.066 × 10⁶⁷ — essentially every fair shuffle in history is a unique event.

Taylor series — computing e¹:
e¹ = 1/0! + 1/1! + 1/2! + 1/3! + … = 1 + 1 + 0.5 + 0.1667 + … ≈ 2.71828

---

Common Mistakes

1. Assuming 0! = 0. The factorial of zero is 1 — required for consistent combinatorial formulas.
2. Applying factorials to negative integers. n! is undefined for negative integers in the standard definition.
3. Applying factorials to non-integers. 3.5! requires the Gamma function: Γ(4.5) ≈ 11.632.
4. Integer overflow in code. C (32-bit int) overflows at 13!. Use 64-bit integers up to 20!, or arbitrary-precision for larger values.
5. Confusing n! with n^n. 5! = 120 but 5^5 = 3,125.

---

Related Calculators

  • Permutation Calculator (nPr)

  • Combination Calculator (nCr)

  • Binomial Probability Calculator

  • Scientific Notation Converter

  • Frequently asked questions

    Why does 0! equal 1 and not 0?

    0! = 1 is a definition required for combinatorial formulas to remain consistent. The number of ways to arrange zero objects is exactly 1 (the empty arrangement). Without this convention, C(n, 0) = n!/(0! × n!) would be undefined instead of correctly equaling 1.

    What are the factorial values from 1 to 10?

    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. Each value equals the previous one multiplied by n: 6! = 6 × 5! = 6 × 120 = 720.

    What is the largest factorial a standard calculator can compute exactly?

    A 64-bit integer (uint64) holds values up to 2^64 − 1 ≈ 1.84 × 10^19, accommodating up to 20! (≈ 2.43 × 10^18) exactly but overflowing at 21!. This calculator uses double-precision floating point and works accurately up to 170! (≈ 7.26 × 10^306); 171! exceeds the double-precision maximum.

    How fast do factorials grow compared to exponential functions?

    Factorials grow faster than any fixed exponential base. For large n, n! grows faster than 2^n, 10^n, or even 1,000^n. Stirling's approximation shows n! ≈ √(2πn)(n/e)^n — a super-exponential growth rate. For comparison, 20! = 2.43 × 10^18 while 2^20 = only 1,048,576.

    What is Stirling's approximation and when should I use it?

    Stirling's approximation is n! ≈ √(2πn) × (n/e)^n. Use it when n is large and an exact value is impractical to compute by hand — for example in statistical mechanics, information theory, and asymptotic algorithm analysis. Its relative error drops below 1% for n ≥ 3 and below 0.1% for n ≥ 10.

    Can I compute the factorial of a decimal like 2.5!?

    Not with the standard n! definition, which requires non-negative integers. For non-integer values, use the Gamma function: Γ(n+1) = n!, so 2.5! = Γ(3.5) ≈ 3.3234. The Gamma function is available in Python as math.gamma(3.5), in R as gamma(3.5), and in Wolfram Alpha.

    How many digits does 100! have?

    100! has exactly 158 digits and starts with 9.332 × 10^157. Estimate the digit count using Stirling: log₁₀(n!) ≈ n·log₁₀(n/e) + 0.5·log₁₀(2πn). For n=100 this gives ≈ 157.97, so 158 digits. 100! also ends in exactly 24 trailing zeros.

    How many trailing zeros does n! have?

    Count trailing zeros using Legendre's formula: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … (sum of integer divisions by powers of 5). For n=100: 20 + 4 = 24 zeros. For n=1000: 200 + 40 + 8 + 1 = 249 zeros. Each factor of 5 paired with a factor of 2 creates one trailing zero; factors of 2 always outnumber factors of 5.

    What real-world applications use factorials?

    Factorials appear in: Probability (binomial and Poisson distributions), Statistical mechanics (Boltzmann entropy formula uses N! for particle microstates), Computer science (the Travelling Salesman Problem for n=20 cities has 19! ≈ 1.2 × 10^17 routes), Genomics (counting possible gene orderings), and Cryptography (permutation cipher key spaces — for a 256-element permutation, 256! ≈ 8.58 × 10^506).

    Sources and references