What is a Factorial Calculator?
A factorial calculator finds n! (read “n factorial”), the product of every whole number from n down to 1. For example, 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720, and 0! = 1 by definition. This calculator gives the exact value of n! for any whole number from 0 to 5,000, with step-by-step working, the number of digits, the trailing zeros, scientific notation and a check against Stirling’s approximation. It also works backwards: enter a number such as 720 and it tells you which factorial it is.
What the Factorial Calculator does
The factorial of a number n counts the ways to put n different objects in order: 3 books fit on a shelf in 3! = 6 orders, and a deck of 52 cards can be shuffled into 52! ≈ 8.07 × 10⁶⁷ orders. Factorials sit inside every permutation and combination formula, the binomial and Poisson probabilities and the Taylor series of eˣ. They grow faster than any exponential: 10! is about 3.6 million, 25! has 26 digits and 1,000! has 2,568.
A handheld calculator with factorial function (the x! key) rounds large results and stops at 69!, because it cannot show numbers of 10¹⁰⁰ or more, and software built on 64-bit floating point stops at 170!. This n! calculator does every factorial calculation with exact integer arithmetic instead, so you can compute factorial values far beyond those limits without losing a digit. Up to 20! it writes the whole product out, results up to 300 digits are printed in full, and larger values come with scientific notation plus the first and last 60 digits. The trailing-zero count uses Legendre’s formula, and for n ≤ 25 a table lists every factorial from 0! up to your n.
How to use the Factorial Calculator
- Leave the mode on n! from n and type a whole number from 0 to 5,000 into Number, n, or tap one of the examples such as 10! or 52!.
- Read n! in the results. Up to 24 digits it is shown in full; above that the headline gives scientific notation and the exact digits appear in a table below.
- Check the number of digits, the trailing zeros, log₁₀(n!), ln(n!) and the Stirling estimate in the statistics.
- Open the step-by-step solution for the multiplied-out product (n ≤ 20), the digit count and the Legendre calculation of the trailing zeros.
- To go the other way, switch to Which factorial is x? and type a number such as 720 or 3,628,800. The calculator divides by 2, 3, 4, … and tells you which n! it is, or which two factorials it falls between.
Factorial formula
The factorial of n multiplies n by every smaller positive whole number. Because each factorial is the one before it times one more factor, n! can also be built up one step at a time: 5! = 5 × 4! = 5 × 24 = 120.
| Symbol | Meaning |
|---|---|
| n | a non-negative whole number |
| n! | n factorial, the product of the whole numbers 1 to n |
| ⌊x⌋ | floor: the largest integer not greater than x |
| e | Euler’s number, 2.71828… |
The gamma function extends factorials to non-integers through n! = Γ(n + 1); this calculator handles whole numbers only.
Definitions follow standard references: Factorial, Wolfram MathWorld, NIST Digital Library of Mathematical Functions, §5.4 and the factorial numbers, OEIS A000142.
Worked example: 20 factorial
Find 20!, its digits and its trailing zeros
Problem. Find 20!, its number of digits and its number of trailing zeros.
- 0120! = 20 × 19 × 18 × … × 2 × 1 = 2,432,902,008,176,640,000.
- 02log₁₀(20!) = 18.386, so the number has ⌊18.386⌋ + 1 = 19 digits.
- 03Trailing zeros: ⌊20/5⌋ + ⌊20/25⌋ = 4 + 0 = 4, matching the four zeros at the end.
- 04Stirling: √(40π) × (20/e)²⁰ ≈ 2.42279 × 10¹⁸, which is 0.4158% below the exact value.
Answer. 20! = 2,432,902,008,176,640,000, a 19-digit number ending in 4 zeros. It is the largest factorial that fits in a signed 64-bit integer.
How to calculate a factorial
To calculate n!, start at n and multiply by each whole number below it until you reach 1. 3 factorial means 3! = 3 × 2 × 1 = 6, the number of ways to line up three objects: ABC, ACB, BAC, BCA, CAB and CBA. In the same way 4! = 4 × 3 × 2 × 1 = 24 and 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720.
When you already know one factorial, the next is a single multiplication: 7! = 7 × 6! = 7 × 720 = 5,040. Ratios of factorials cancel instead of being multiplied out, so 10! / 8! = 10 × 9 = 90. That cancelling is how the permutation and combination formulas stay manageable.
Which factorial is a number? To find the n with n! = x, divide x by 2, then 3, then 4 and so on until you reach 1. For 720: 720 ÷ 2 = 360, ÷ 3 = 120, ÷ 4 = 30, ÷ 5 = 6, ÷ 6 = 1, so 720 = 6!. If a division leaves a remainder before you reach 1, the number is not a factorial. The Which factorial is x? mode at the top of this page does these divisions for you, even for numbers with thousands of digits.
Factorial table from 0! to 25!
Exact values of the factorials people look up most often, such as 6!, 14! and 25!. Enter any other n above for its exact value and steps.
| n | n! | n | n! |
|---|---|---|---|
| 0! | 1 | 13! | 6,227,020,800 |
| 1! | 1 | 14! | 87,178,291,200 |
| 2! | 2 | 15! | 1,307,674,368,000 |
| 3! | 6 | 16! | 20,922,789,888,000 |
| 4! | 24 | 17! | 355,687,428,096,000 |
| 5! | 120 | 18! | 6,402,373,705,728,000 |
| 6! | 720 | 19! | 121,645,100,408,832,000 |
| 7! | 5,040 | 20! | 2,432,902,008,176,640,000 |
| 8! | 40,320 | 21! | 51,090,942,171,709,440,000 |
| 9! | 362,880 | 22! | 1,124,000,727,777,607,680,000 |
| 10! | 3,628,800 | 23! | 25,852,016,738,884,976,640,000 |
| 11! | 39,916,800 | 24! | 620,448,401,733,239,439,360,000 |
| 12! | 479,001,600 | 25! | 15,511,210,043,330,985,984,000,000 |
Factorial word problems: arranging objects
Books on a shelf. In how many orders can 7 different books stand on a shelf? The first place has 7 choices, the second 6, and so on, so the count is 7! = 5,040.
Arranging letters. The letters of MATH are all different, so they form 4! = 24 arrangements. When letters repeat, divide by the factorial of each repeat count, because swapping identical letters gives nothing new: BOOK gives 4! / 2! = 12, and MISSISSIPPI gives 11! / (4! × 4! × 2!) = 34,650.
Race finishes. Eight runners can finish a race in 8! = 40,320 different orders. If only the first three places matter, use the Permutation Calculator instead: P(8, 3) = 8! / 5! = 336.
Seating around a table. Around a round table only the positions relative to each other count, so fix one person and arrange the rest: 6 people can sit in (6 − 1)! = 5! = 120 distinct ways.
How fast factorials grow
Factorials overtake every exponential function. 2ⁿ doubles at each step, but n! multiplies by n, so the gap widens without limit. The table shows a few landmarks; Stirling’s formula explains why the number of digits grows a little faster than n log₁₀ n.
| n | n! | Digits | Trailing zeros |
|---|---|---|---|
| 5 | 120 | 3 | 1 |
| 10 | 3,628,800 | 7 | 2 |
| 20 | 2,432,902,008,176,640,000 | 19 | 4 |
| 52 | ≈ 8.06582 × 10⁶⁷ | 68 | 12 |
| 100 | ≈ 9.33262 × 10¹⁵⁷ | 158 | 24 |
| 1,000 | ≈ 4.02387 × 10²⁵⁶⁷ | 2,568 | 249 |
How to do a factorial on a calculator, in Excel and in code
On a TI-83 or TI-84, type n, press MATH, move right to PRB, choose 4: ! and press ENTER. On most Casio scientific models the x! key is SHIFT + x⁻¹. Handheld calculators show about 10 significant digits and spreadsheets 15, so both round large factorials, and they give an error past 69! and 170! respectively. For exact answers use this page; to put factorials inside a longer expression, such as 8! / (3! × 5!), use the Scientific Calculator.
| Tool | Factorial of n | Limits |
|---|---|---|
| Excel and Google Sheets | =FACT(n) | 15 significant digits; error above 170 |
| Python | math.factorial(n) | Exact for any n |
| R | factorial(n) | Floating point; Inf above 170 |
| TI-84 | n ! | Error above 69! |
| This calculator | n | Exact up to 5,000! |
Common use cases
- Counting arrangements: the orders of n objects, such as 52! ≈ 8.07 × 10⁶⁷ ways to shuffle a deck.
- Combinatorics: the building block of the permutation and combination formulas, nPr = n! / (n − r)! and nCr = n! / (r!(n − r)!).
- Probability distributions: the coefficients in the binomial and Poisson formulas.
- Number theory and programming exercises: digit counts, trailing zeros and checks on big-integer code.
- Calculus: the denominators of Taylor and Maclaurin series such as eˣ = Σ xⁿ / n!.
Assumptions and limitations
- Only whole numbers from 0 to 5,000 are accepted. Factorials of negative integers are undefined; non-integers need the gamma function.
- Results beyond 300 digits are summarized by their leading and trailing digits rather than printed in full.
- Stirling’s formula is an approximation that always slightly underestimates n!; use the exact value for counting problems.
- In probability work you usually need a ratio of factorials. Computing it directly with the Combination Calculator avoids handling enormous intermediate numbers.
Frequently asked questions
What is a factorial?
What does 3 factorial mean?
What factorial is 720?
Why is 0! equal to 1?
How do you do a factorial on a calculator?
How many trailing zeros does 100! have?
How many digits does 100! have?
How accurate is Stirling’s approximation?
Can you take the factorial of a negative number or a decimal?
Cite this page
Statculator. (2026, November 14). Factorial Calculator. Retrieved November 14, 2026, from https://statculator.com/probability/factorial-calculator/