Factorial Calculator

Factorial Calculator (n!)

n!
Scientific Notation
Number of Digits

First 20 Factorials

nn!Approx.

Factorial Calculator – What Is n! and How to Use It

The factorial of a non-negative integer n, written as n!, is the product of all positive integers from 1 to n. Our free online factorial calculator computes n! for any integer from 0 to 170 instantly, shows the result in full (for small values) and scientific notation, and displays the number of digits in the result.

Factorial Definition and Examples

n! = n × (n−1) × (n−2) × … × 2 × 1

  • 0! = 1 (by definition — the empty product)
  • 1! = 1
  • 5! = 5 × 4 × 3 × 2 × 1 = 120
  • 10! = 3,628,800
  • 20! = 2,432,902,008,176,640,000

Factorials grow extremely fast. 100! has 158 digits, and 170! ≈ 7.26 × 10³⁰⁶ — the largest factorial that fits in a JavaScript 64-bit float.

Why Is 0! Equal to 1?

There are several ways to understand this. The most intuitive: n! counts the number of ways to arrange n distinct items (permutations). There is exactly one way to arrange zero items (do nothing), so 0! = 1. Mathematically, the recursive definition n! = n × (n−1)! requires 1! = 1 × 0!, and since 1! = 1, we get 0! = 1.

Applications of Factorials

  • Permutations: The number of ways to arrange n distinct items = n!
  • Combinations: C(n, k) = n! / (k! × (n−k)!) — choosing k items from n.
  • Probability: Card game, lottery, and sampling calculations.
  • Taylor series: e^x = Σ xⁿ/n! — factorials appear in infinite series expansions.
  • Binomial theorem: (a+b)^n expansion coefficients involve n!.
  • Computer science: Factorial is a classic recursive algorithm example.

Factorial Growth Rate

Factorials grow faster than any exponential function. By Stirling's approximation: n! ≈ √(2πn) × (n/e)^n. This is why even modest values of n produce astronomically large factorials, and why the number of possible arrangements (permutations) of a deck of 52 cards — 52! ≈ 8 × 10⁶⁷ — exceeds the number of atoms in the observable universe.

Frequently Asked Questions

What is the largest factorial this calculator can compute?
170! is the largest factorial that fits in JavaScript's 64-bit double precision float. 171! would equal Infinity. For n ≤ 20, the calculator returns the exact full integer using BigInt. For n = 21 to 170, scientific notation is used.
Can I calculate the factorial of a decimal number?
Factorials of non-integers are defined via the Gamma function (n! = Γ(n+1)), but this calculator only accepts non-negative integers (0, 1, 2, 3, …), which covers the standard use cases in combinatorics and algebra.
What is factorial used for in probability?
Factorials appear in the formulas for permutations (ordered arrangements) and combinations (unordered selections). For example, the probability of dealing a specific poker hand involves combinations: C(52,5) = 52!/(5!×47!) = 2,598,960 possible 5-card hands.
How quickly does factorial grow?
Very quickly — faster than any exponential. 10! = 3.6 million; 20! ≈ 2.4 quintillion; 52! ≈ 8×10⁶⁷. This super-exponential growth is why brute-force approaches to problems involving permutations quickly become computationally infeasible.
Is there a negative factorial?
Factorials are not defined for negative integers in the standard sense (the Gamma function has poles at negative integers). The calculator accepts only non-negative integers (0 and above).