Sign up
Factorial calculator →

Factorial guide

The Factorial Calculator computes the product of all positive integers up to n (n!). It also provides the number of trailing zeros, the total number of digits, and the scientific notation for very large results.

Worked examples

Calculate 5 factorial

  1. Enter 5 in the input field.
  2. Click Calculate.
Result: 5! = 120

5! = 5 × 4 × 3 × 2 × 1 = 120.

Calculate a large factorial

  1. Enter 10.
  2. Click Calculate.
Result: 10! = 3,628,800

10! is 10 × 9 × 8 × ... × 1. The tool automatically formats it with commas for readability.

Check the definition of zero factorial

  1. Enter 0.
  2. Click Calculate.
Result: 0! = 1

By mathematical convention (and to make combinatorial formulas work), the factorial of 0 is defined as 1.

Tips

  • •Use the "Factorial Cheat Sheet" to generate a table from 0! to 30!.
  • •Factorials grow incredibly fast. 20! is already 2.4 quintillion.
  • •The calculator uses BigInt to calculate exact values up to 170!.

Frequently asked questions

What is a factorial?
The factorial of a non-negative integer n, denoted as n!, is the product of all positive integers less than or equal to n.
Why is 0! equal to 1?
It is an empty product. Mathematically, multiplying no numbers together yields the multiplicative identity, which is 1. It also makes formulas like combinations (nCr) work smoothly when r=0.
What is the largest number this calculator can handle?
It supports inputs up to 170. Anything larger (171!) exceeds the maximum limit of standard JavaScript numbers and returns Infinity.
What are trailing zeros in a factorial?
They are the zeros at the end of the number. They are created by multiplying factors of 10, which come from pairs of 2s and 5s.
How are trailing zeros calculated?
Using Legendre’s formula: floor(n/5) + floor(n/25) + floor(n/125) + ... This counts the number of factors of 5 without calculating the full factorial.
Can I use decimals in factorials?
No. Factorials are strictly defined for non-negative integers. The calculator will show an error if you enter a decimal.
Can I calculate negative factorials?
No. The gamma function extends factorials to some negative non-integers, but standard factorials require n ≥ 0.
What is the difference between n! and nPr/nCr?
n! is a single number. Permutations (nPr) and combinations (nCr) use factorials to calculate arrangements and selections: nPr = n! / (n-r)!, nCr = n! / (r!(n-r)!).
Where are factorials used?
In combinatorics (probability, permutations), calculus (Taylor series), and algorithm analysis.
What is a double factorial?
It is the product of every second integer (e.g., 5!! = 5 × 3 × 1 = 15). This calculator only does standard factorials.
How many digits does 100! have?
100! has 158 digits.
What is the number of digits formula?
The number of digits in n! is floor(log10(1) + log10(2) + ... + log10(n)) + 1. The calculator computes this efficiently.
What does the scientific notation output mean?
For large factorials, it shows the value in the format a × 10^b, which is easier to read than a massive string of digits.
Is the factorial result exact?
Up to 170!, the calculator uses BigInt to ensure the exact integer value is calculated without floating-point rounding errors.
Why do trailing zeros stop increasing?
They don’t. As n increases, the number of trailing zeros steadily increases, because there are always plenty of 2s to pair with the 5s.
What is 1!?
1! = 1.
How does the factorial relate to e (Euler’s number)?
The sum of the reciprocals of factorials (1/0! + 1/1! + 1/2! + ...) converges to the number e.
Can I copy the result?
Yes, there are dedicated copy buttons for the exact number, the scientific notation, and the full analysis.