Factorial calculator (n!)
Calculate the factorial of a number (n!) and see the product expansion for small numbers.
A factorial multiplies all integers from 1 to n. By definition, 0! = 1. Above ~18! the exact value exceeds computer precision and is shown in scientific notation.
How the calculation works
The factorial of a number n, written n!, is the product of all positive integers from 1 to n:
n! = n × (n−1) × … × 2 × 1
Step-by-step example
5! = 5 × 4 × 3 × 2 × 1 = 120. Since 4! = 24, you can reuse: 5! = 5 × 4!.
What it counts
Factorial tells how many ways n distinct items can be ordered (permutations). Ordering 5 books: 5! = 120. It's the basis of combinatorics and probability.
It grows fast
10! already exceeds 3.6 million; 20! passes 2 quintillion.
Examples
- 6! = 720 (6 × 120).
- Anagrams of a 4-distinct-letter word: 4! = 24.
Frequently asked questions
Why is 0! = 1?
Because there is exactly one way to arrange "nothing" — the empty list. It also keeps combination formulas consistent.
Factorial of a negative or decimal?
Not in the basic sense. Math uses the gamma function, a generalization, for those.
Factorial vs permutation?
n! is ordering ALL n items. Permutations of n taken k at a time use a ratio of factorials.
Why does 0! equal 1?
Combinatorially there is exactly one way to arrange nothing; and n! = n × (n−1)! only holds at n = 1 if 0! is 1.
Arrangement versus combination?
Order. It matters in arrangements (podium, password) and not in combinations (committee, hand of cards).
Why can't it compute very large factorials?
Because the value overflows common numeric types: precision is lost around 18! and overflow occurs near 171!.
Is a shuffled deck really unique?
Practically yes. 52! ≈ 8 × 10⁶⁷ orderings, more than the estimated atoms in the Milky Way.
Related calculators
Combinations & permutations
Calculate combinations C(n,r), arrangements P(n,r) and the factorial from n and r.
Sequence (arithmetic & geometric)
Find the nth term and the sum of an arithmetic (AP) or geometric (GP) sequence.
Prime factorization
Check if a number is prime and get its prime factorization and number of divisors.
More Math calculators
See all →Scientific calculator
Free online scientific calculator: sine, cosine, tangent, root, power, log, ln, π and parentheses.
Percentage
Calculate percentages every way: X% of Y, increase, discount and percentage change.
Rule of three
Solve a simple rule of three (direct or inverse): enter three values and find the fourth.
Compound rule of three
Solve problems where two quantities vary at once (machines, days, output...), directly or inversely.
Area of shapes
Calculate the area of a square, rectangle, triangle, circle and trapezoid in seconds.
Pythagorean theorem
Find the hypotenuse or a leg of a right triangle (a² + b² = c²).
Logarithm
Calculate the logarithm of a number in any base, plus natural log (ln), log10 and log2.
Trigonometry (sin, cos, tan)
Calculate the sine, cosine and tangent of an angle in degrees or radians.
Updated on June 30, 2026 · by Rafael Rossi · Methodology & sources