Factorial Calculator
Calculate the factorial of any whole number (n!) instantly, with a step-by-step product chain and a quick-reference table of small factorials.
Calculate the factorial of any whole number (n!) instantly, with a step-by-step product chain and a quick-reference table of small factorials.
The vertical axis counts digits, so each gridline is ten times the one below. Plotted linearly, the factorial curve would leave the chart before n = 10.
How 20! is built (showing the last steps of the chain)
20! has 19 digits
n! is the product of every whole number from 1 to n, and it counts the number of ways to arrange n distinct things in order. 20 items can be put in 19-digit-many different orders.
Factorial overtakes exponential growth at n = 4, and never looks back
3! is 6 and 2³ is 8, so up to there the exponential looks like the fast one. At n = 4 they cross — 24 against 16 — and the gap only widens. At n = 20, n! is 2,320,196,159,531 times larger than 2ⁿ. This is why "exponential" is not the strongest word available for how fast something grows.
This is why you cannot just try every order
Checking all 10^18 arrangements at a billion per second would take about 10^2 years. Brute-forcing a travelling-salesman route or a permutation lock fails not because computers are slow but because factorial growth is faster than any amount of speed can fix.
Past 20!, the exact digits stop being reliable
20! is the largest factorial that fits exactly in a double-precision number. Beyond it the magnitude stays right while the last digits drift — this page therefore works in logarithms and reports the digit count, which is honest, rather than printing digits it cannot vouch for.
Stirling's approximation is already within 0.416% at n = 20
n! ≈ √(2πn)·(n/e)ⁿ. It is within 1% by n = 9 and keeps improving, which is remarkable for a formula with no factorials in it. It is how factorials of large numbers are handled in practice, and why "roughly how big is 1000!" is an easy question even though the number has 2,568 digits.
What the factorial counts
Arrangements, not selections. n! is every ordering of all n items; nPr is every ordering of r of them; nCr is every selection of r ignoring order. They are all built from factorials, and which one you want depends entirely on whether order matters.
Worked out in your browser — nothing is sent anywhere.
Save this result, change your inputs, and recalculate to compare scenarios side by side.
How many ways can 8 people sit at a table? 8! answers seating, playlists, and race orders.
Permutations and combinations are built on factorials — get the big numbers right.
See how quickly arrangements explode — why shuffled decks and passphrases are so hard to guess.
Estimate the search space of puzzles and games before brute-forcing them.
52! is roughly 8×10⁶⁷. A properly shuffled deck has almost certainly never appeared in that exact order before anywhere in history.
Ten guests around a round table can be arranged 362,880 ways once one seat is fixed. It explains why the wedding seating chart took a whole evening.
The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 to n: n! = n × (n−1) × (n−2) × … × 2 × 1. Examples: 0! = 1 (by convention); 1! = 1; 2! = 2; 3! = 6; 4! = 24; 5! = 120; 6! = 720; 7! = 5,040; 8! = 40,320; 9! = 362,880; 10! = 3,628,800. The 0!=1 convention is not arbitrary — it makes the combinatorics formulas work correctly for edge cases like "choose 0 from n."
Factorials appear throughout mathematics and science: Permutations — the number of ways to arrange n distinct objects in order is n! (e.g. 5 books on a shelf = 5! = 120 arrangements). Combinations — choosing r items from n: C(n,r) = n! ÷ (r! × (n−r)!). Probability — poker hand probabilities use C(52,5) = 52!/(5!×47!). Calculus — Taylor series: eˣ = 1 + x + x²/2! + x³/3! + … Physics — Stirling's approximation (ln n! ≈ n ln n − n) is used in statistical mechanics and thermodynamics.
Factorials are a product of increasing multipliers, so they grow superexponentially — faster than any exponential function like 2ⁿ. Quick scale reference: 10! ≈ 3.6 million; 15! ≈ 1.3 trillion; 20! ≈ 2.4 × 10¹⁸; 25! ≈ 1.6 × 10²⁵; 52! ≈ 8 × 10⁶⁷ (the number of ways to shuffle a deck of cards — more than the estimated number of atoms in the observable universe, which is ~10⁸⁰). This explosive growth is why even 100! (about 9.3 × 10¹⁵⁷) requires arbitrary-precision arithmetic to represent exactly.
Permutations count ordered arrangements; combinations count unordered selections. Permutations (order matters): P(n,r) = n! ÷ (n−r)!. Example: arranging 3 of 5 letters = P(5,3) = 5!/2! = 60. Combinations (order does not matter): C(n,r) = n! ÷ (r! × (n−r)!). Example: choosing 3 from 5 = C(5,3) = 5!/(3!×2!) = 10. The relationship: C(n,r) = P(n,r) ÷ r! — since each combination corresponds to r! permutations of the same items. Lottery odds use combinations: C(49,6) = 49!/(6!×43!) ≈ 14 million (why winning is so rare).
Factorials are only defined for non-negative integers, but the Gamma function Γ(n) extends the concept to real and complex numbers: Γ(n) = (n−1)! for positive integers, and Γ(1/2) = √π ≈ 1.772. This means you can compute "half-factorial": (1/2)! = Γ(3/2) = √π/2 ≈ 0.886. The Gamma function appears in probability distributions (chi-squared, beta, Student's t), physics (quantum mechanics, statistical mechanics), and complex analysis. It is one of the most important functions in advanced mathematics.