Factorial Calculator
Instantly compute the factorial of any non-negative integer. Use it for combinatorics, permutations, probability problems, and algebra involving n!
About this calculator
The factorial of a non-negative integer n, written as n!, is the product of all positive integers from 1 up to n. The formula is: n! = 1 × 2 × 3 × … × n. By convention, 0! = 1. Factorials grow extraordinarily fast — 20! already exceeds 2.4 quintillion. They appear in combinatorics (counting permutations and combinations), probability distributions like the Poisson and binomial, Taylor series expansions, and many areas of discrete mathematics. The recursive definition states n! = n × (n − 1)!, with the base case 1! = 1.
How to use
Suppose you want to find 6!. Enter 6 into the Number field. The calculator multiplies all integers from 1 to 6: 1 × 2 × 3 × 4 × 5 × 6 = 720. So 6! = 720. This result tells you there are 720 distinct ways to arrange 6 unique objects in a sequence. Try n = 0 to confirm the special case: 0! = 1.
Frequently asked questions
What is the factorial of 0 and why does it equal 1?
By mathematical convention, 0! is defined as 1. This is not arbitrary — it ensures that combinatorial formulas such as C(n, 0) = n! / (0! × n!) work correctly and yield 1. It also aligns with the empty product principle: the product of no numbers is the multiplicative identity, which is 1. This definition is universally accepted across mathematics and is built into this calculator.
How are factorials used in permutations and combinations?
Factorials are the backbone of counting in combinatorics. The number of ways to arrange n distinct objects is n!. The number of permutations of r items chosen from n is P(n, r) = n! / (n − r)!. Combinations (where order doesn't matter) use C(n, r) = n! / (r! × (n − r)!). For example, choosing 3 items from 5 gives C(5, 3) = 120 / (6 × 2) = 10 possible groups.
Why do factorials grow so fast and what is the largest factorial I can calculate?
Each step multiplies by an increasingly large integer, causing factorial values to grow faster than exponential functions. For reference, 10! = 3,628,800 and 20! ≈ 2.43 × 10¹⁸. Standard JavaScript numbers (64-bit floating point) can represent exact integers up to about 2⁵³, so results beyond roughly 18! begin to lose precision. For extremely large factorials, dedicated big-integer libraries or Stirling's approximation (n! ≈ √(2πn) × (n/e)ⁿ) are more appropriate.