Factorial Calculator
Calculate factorial n!, permutations P(n,r), and combinations C(n,r) with step-by-step working.
Every digit exact up to 1000! for probability problems.
Factorial is one of the most fundamental operations in combinatorics, probability, and discrete mathematics. It represents the number of ways to arrange a set of distinct objects.
Factorial definition:
n! = n × (n−1) × (n−2) × ... × 2 × 1
0! = 1 (by convention, since there is exactly one way to arrange zero objects)
Worked examples:
- 5! = 5 × 4 × 3 × 2 × 1 = 120
- 10! = 3,628,800
- 20! = 2,432,902,008,176,640,000
Permutations, the ordered arrangements:
P(n, r) = n! / (n − r)!
How many ways can you arrange 3 books chosen from a shelf of 7? P(7, 3) = 7! / 4! = 5,040 / 24 = 210 arrangements
Combinations, the unordered selections:
C(n, r) = n! / (r! × (n − r)!)
How many ways can you choose 3 students from a class of 20? C(20, 3) = 20! / (3! × 17!) = 6,840 / 6 = 1,140 combinations
Stirling’s approximation (for very large n):
n! ≈ √(2πn) × (n/e)^n
It undershoots by roughly 1/(12n), so at n = 100 it is about 0.08% low and the leading digits are already right. The calculator shows it beside the exact answer so you can watch the gap close.
About precision. This page works in arbitrary-precision integers, so every digit it prints is exact, all the way to 1000!. That matters more than it sounds. An ordinary JavaScript number stops being able to hold a factorial exactly somewhere around 22!, and after that you get a value that looks right and is quietly wrong in its lower digits. If a calculator hands you 25! as 15,511,210,043,330,985,984,000,000 it is telling the truth; if it hands you 1.5511210043331e+25 it is telling you it gave up.
Real-world applications:
- Card games: a shuffled deck has 52! ≈ 8.07 × 10⁶⁷ orderings, which is why any well-shuffled deck has almost certainly never existed before
- Probability: exact odds in lotteries, where C(49, 6) = 13,983,816 is the classic
- Statistics: binomial coefficients, the C(n, r) tab on this page
- Computer science: algorithm complexity analysis, e.g. O(n!) brute-force over permutations
- Scheduling: number of possible task orderings
Growth rate: Factorial grows faster than exponential. 20! has 19 digits; 100! has 158 digits; 1000! has 2,568.
How we build and check this calculator
This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.