Factorial Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/5/2026
The factorial of n (written n!) is the product of all integers from 1 to n: n! = n × (n−1) × ... × 2 × 1. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.
Explanation
The factorial of a positive integer counts the number of different ways to arrange (permute) n distinct objects: with 5 different objects, there are exactly 5! = 120 different ways to arrange them in a specific order. This property is what makes the factorial ubiquitous in combinatorics and probability calculations. The factorial grows extremely fast: 10! already exceeds 3.6 million, and 20! has 19 digits, far beyond what naive intuition might expect from such a modest starting number. By mathematical convention, 0! is defined as equal to 1 (not 0): this convention isn't arbitrary, it ensures the consistency of many combinatorial formulas (such as the number of ways to arrange an empty set, which is exactly one way: doing nothing). This calculator is capped at 170, because 170! is the largest factorial that remains representable without exceeding the maximum value of a standard floating-point number; beyond that, the result would be mathematically correct but technically impossible to display with precision. Like other fundamental integer properties, such as computing a greatest common divisor and least common multiple or extracting an nth root, the factorial is a basic concept in discrete mathematics that underpins many more advanced results in combinatorics.
Example: calculating 5!
Inputs
Integer (n): 5.
Calculation
5! = 5 × 4 × 3 × 2 × 1 = 120.
Result
The factorial of 5 is 120.
Frequently asked questions
Why is 0! equal to 1 and not 0?
By mathematical convention, motivated by the consistency of combinatorial formulas: the number of ways to arrange an empty set (containing no elements) is exactly one way (arranging nothing), not zero ways. This convention also lets formulas like the number of combinations remain valid and consistent even in edge cases involving an empty set.
Why does the factorial grow so fast?
Because each additional term in the product multiplies the result by an increasingly large number: going from n! to (n+1)! amounts to multiplying by (n+1), a factor that itself grows at each step. This 'super-exponential' growth quickly outpaces even that of a simple exponential: that's why 20! already exceeds 2.4 quintillion, a 19-digit number.
Is the factorial defined for non-integer or negative numbers?
The classic factorial is only defined for non-negative integers. A generalization exists for non-integer numbers (the Gamma function), but it's beyond the scope of this calculator, which focuses on the classic integer case most commonly searched for. The factorial, however, is never defined for a strictly negative integer.