Factorial Calculator
Calculate factorials, even for very large numbers.
The factorial n! is the product of every whole number from 1 to n. By definition 0! = 1. Results are computed exactly with BigInt.
20! ≈ scientific notation
2.432902 × 10¹⁸
Number of digits
19
Input
20!
2,432,902,008,176,640,000
How to use Factorial Calculator
What this calculator does
This tool computes the factorial of a non-negative whole number. You enter n and it returns n! — the product of every integer from 1 up to n. Because factorials grow so rapidly, the calculator does three things at once: it shows the full exact result in a scrollable container (it can run to thousands of digits), it reports how many digits that result has, and it gives a compact scientific-notation approximation for a quick sense of scale. Every result can be copied with one click and recalculates live as you type.
Why you might need it
Factorials are everywhere in counting problems. They give the number of ways to order a set of items, which makes them the backbone of permutations and combinations. Probability calculations — lottery odds, card hands, arrangements — lean on factorials directly. They appear in the binomial theorem, in Taylor series such as the expansion of e and sine, and in many statistical formulas. Students checking combinatorics homework, programmers verifying an algorithm, and anyone curious about how fast factorial growth really is all benefit from a calculator that handles the huge numbers involved without rounding.
How to use it
- Type a non-negative whole number into the input field. The value is capped at 10,000 to keep the calculation instant.
- Read the scientific-notation approximation in the headline card for a quick sense of the magnitude.
- Check the digit count to see exactly how large the result is.
- Scroll the exact result panel to view every digit, and use the copy buttons to save the full number.
How it’s calculated
The factorial is defined by n! = n × (n−1) × (n−2) × … × 2 × 1, with the base case 0! = 1. The calculator computes this iteratively: it starts with a running product of 1 and multiplies in each integer from 2 up to n. Crucially, the running product is held as a BigInt, JavaScript’s arbitrary-precision integer type, so no digits are ever lost to rounding. Factorial growth is faster than exponential — the number of digits roughly follows Stirling’s approximation, ln(n!) ≈ n ln n − n — which is why 10! has 7 digits but 1000! has 2568. The scientific-notation figure is derived from the exact result by taking its first significant digits as the mantissa and the digit count minus one as the power of ten.
Common pitfalls
The first surprise is usually how quickly factorials explode: 13! already exceeds two billion, and 21! exceeds what an ordinary 64-bit number can hold exactly — which is why BigInt is essential. Another common slip is forgetting that 0! is 1, not 0. Factorials are also defined only for non-negative whole numbers here; the generalisation to fractions and negatives uses the gamma function, which this tool does not cover. Finally, the scientific-notation value is an approximation for readability — the panel labelled “exact result” holds the precise answer.
Tips
To compute a permutation count, remember nPr = n! ÷ (n−r)!, and for combinations nCr = n! ÷ (r! × (n−r)!) — you can calculate each factorial here and divide. The digit count is a handy way to compare magnitudes without reading every digit. Because the whole computation runs locally with exact BigInt arithmetic, you can experiment with large values freely, and nothing you enter ever leaves your browser.
Frequently asked questions
What is a factorial?
Why does 0! equal 1?
How can the tool show factorials with thousands of digits?
Why is n capped at 10,000?
Is my input sent anywhere?
Related tools
Permutation & Combination Calculator
Calculate permutations (nPr) and combinations (nCr).
Fibonacci Generator
Generate the Fibonacci sequence up to any term.
Prime Number Checker
Check whether a number is prime.
GCD & LCM Calculator
Find the GCD and LCM of multiple numbers.
Prime Number Generator
Generate primes with the Sieve of Eratosthenes.
Probability Calculator
Calculate basic probabilities.