Factorial Calculator
Exact n! for whole numbers 0 to 10,000, with the digit count and trailing zeros — and a labelled estimate beyond that.
Inputs
Exact n! for whole numbers 0 to 10,000.
Enter n and press Calculate, or load an example.
0! = 1 by definition (the empty product). The exact limit of 10,000 is a resource limit for this page; the arithmetic is exact with no rounding, using arbitrary-precision integers (BigInt), so there is never an “Infinity” answer.
Before you rely on this: First-pass guide only. Verify safety-critical or regulated work against the relevant standards, your project requirements and a qualified professional.
How to use this calculator
- Enter n as a whole number in digits (0 or more).
- Keep “Exact value” for n up to 10,000, or choose the digit-count estimate for larger n.
- Press Calculate; long results are collapsed on screen and can be copied or downloaded in full.
How it works
n! = 1 × 2 × 3 × … × n, with 0! = 1 (the empty product). The multiplication uses exact arbitrary-precision integers (BigInt), so every digit is exact — there is no rounding and never an “Infinity” result.
Trailing zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …, because each zero needs a factor 5 (and there are always more 2s).
Above n = 10,000 the exact value is not computed (a page resource limit, not a mathematical one); the digit count then comes from Stirling’s series for log₁₀(n!) and is labelled an estimate. Decimals, negatives and e-notation are rejected rather than rounded.
Worked example
20!. 1 × 2 × … × 20 = 2,432,902,008,176,640,000 exactly — 19 digits, with ⌊20/5⌋ = 4 trailing zeros. For comparison 5! = 120, and 100! has 158 digits and 24 trailing zeros.
Frequently asked questions
Why use BigInt?
Ordinary JavaScript numbers hold only about 15–17 significant digits and overflow to Infinity after 170!. BigInt integers have no fixed size, so 20! = 2432902008176640000 and even 10,000! (35,660 digits) are exact.
What is 0 factorial?
0! = 1 by definition: it is the empty product, and there is exactly one way to arrange nothing. This keeps formulas such as n! = n × (n − 1)! and nCr working at the edges.
Can I download a large result?
Yes. Long values are shortened on screen (first and last digits) with a Show all option, and Download .txt saves every digit with the digit count and trailing zeros.
Related tools
- Permutations Calculator
- Combinations Calculator
- Probability Calculator
- Scientific Calculator
- Scientific Notation Converter
- Combinations with Repetition Calculator
Explore more in Maths, Education & Science.
Cite this tool
Zerdly. (2026). Factorial Calculator. Retrieved from https://www.zerdly.com/tools/factorial-calculator/
Tip: Enter any known values to calculate the remaining results.
Designed to run locally in your browser. Tool inputs are not intentionally stored by Zerdly unless stated otherwise.



