Factorial Calculator
Exact n! to 20,000, digits, trailing zeros and gamma function.
About this tool
Enter a whole number from 0 to 20,000 to get the exact factorial (with a copy button), the number of digits and trailing zeros, scientific notation and Stirling's approximation. Up to 3,000 you also get the double factorial and subfactorial; decimals use the gamma function.
Factorials explained
The factorial n! is 1 ร 2 ร 3 ร โฆ ร n, the number of ways to arrange n distinct objects. It grows faster than any exponential: 10! is 3,628,800, 20! is 2,432,902,008,176,640,000 (the largest that fits in a 64-bit integer), and 52!, the orderings of a deck of cards, has 68 digits. This tool uses arbitrary-precision integers, so results are exact rather than rounded. The number of trailing zeros is โn/5โ + โn/25โ + โn/125โ + โฆ, because each zero needs a factor of 5 paired with a 2; 100! has 158 digits and 24 trailing zeros. Stirling's approximation, n! โ โ(2ฯn)(n/e)^n, gets more accurate as n grows. The double factorial n!! multiplies every other number (7!! = 7 ร 5 ร 3 ร 1 = 105), and the subfactorial !n counts derangements, arrangements where nothing is in its original place (!5 = 44). By convention 0! = 1, and the gamma function extends factorials to non-integers: 0.5! = โฯ/2 โ 0.8862. The permutation and combination calculator and the big number calculator are related.
Frequently asked questions
What is 0 factorial?
0! = 1 by definition: there is exactly one way to arrange nothing.
How many trailing zeros does 100! have?
24: โ100/5โ + โ100/25โ = 20 + 4.
How many digits are in 100!?
158 digits.
Can you take the factorial of a decimal?
Yes, via the gamma function: x! = ฮ(x + 1). For example 0.5! โ 0.8862.
Is my data sent anywhere?
No. Everything is calculated in your browser, and nothing is stored or sent.