Count ordered selections, P(n, r) = n!/(n-r)!, exactly and without building a huge factorial.
Factorial Calculator
Compute an exact factorial of any size, with its digit count and trailing zeros, well past where floating point fails.
- Free
- No sign-up
- Runs in your browser
Input
From 0 to 20,000.
Try an example
Ready
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Enter a non-negative whole number.
- 2
The exact value appears; for large inputs the full number is available as a download.
Questions about Factorial Calculator
Why is 0! equal to 1?
Because there is exactly one way to arrange nothing - the empty arrangement. The convention is what makes the formulas for permutations and combinations work at their boundaries: C(n, 0) should be 1, and the formula n!/(0!(n-0)!) only gives that if 0! is 1.
Can I trust the digits of a large factorial?
Yes, all of them. This uses arbitrary-precision integers, so 100! is correct to all 158 digits. Anything computing factorials in ordinary floating-point numbers starts returning wrong values at 21!, which is the first factorial above 2^53 - and it returns them without any warning.
Why count trailing zeros?
It is a classic exercise, and the answer is not obtained by computing the factorial. Each trailing zero needs a factor of 10, which needs a 2 and a 5, and factorials always have more 2s than 5s - so the count is just the number of factors of 5, which Legendre’s formula gives directly: n/5 + n/25 + n/125 and so on.
What about the factorial of a fraction?
That needs the gamma function, which extends the factorial to fractional and negative arguments - the factorial of 1/2 is the square root of pi over 2. This tool covers whole numbers only and says so rather than guessing.
Is my data sent anywhere?
No. This runs as JavaScript in your browser tab: there is no network request carrying your numbers, nothing reaches a server log, and it keeps working with your connection off. You can confirm it in the browser’s network panel.
Related tools
Other tools you might reach for next.
Count unordered selections, C(n, r), exactly using the multiplicative formula rather than factorials.
Compute a simple probability exactly from favourable and total outcomes, with its complement and odds.
Evaluate an expression with exact fraction arithmetic, trigonometry, logarithms and factorials, reporting whether the result is exact.
Reduce a fraction to lowest terms, with its mixed number and exact decimal form including any repeating block.
Add two fractions exactly, showing the common denominator step and reducing the result.
Subtract one fraction from another exactly, showing the common denominator step.
Multiply two fractions exactly, multiplying across and reducing the result.