Factorial Calculator
Enter any number and instantly get its factorial (n!). See the step-by-step multiplication, trailing zeros, digit count, and exact value up to 170!. Free, private, and runs entirely in your browser.
Enter a Number
Enter a number and click Calculate Factorial to see the result with a step-by-step breakdown.
Step-by-step breakdown
Summary
What does this Factorial Calculator do?
This free online factorial calculator computes the factorial of any non-negative integer up to 170. The factorial of a number n, written as n!, is the product of all positive integers from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.
Beyond just giving you the answer, this calculator shows a step-by-step breakdown of the multiplication, counts the number of digits in the result, and tells you how many trailing zeros the factorial has. For large values where the exact number becomes unwieldy, it also displays the result in scientific notation.
Everything runs locally in your browser. The number you enter never leaves your device — no server, no logs, no tracking. You can calculate as many factorials as you want, with no limits and no signup.
How to calculate a factorial
- Enter a number: Type any non-negative integer (0, 1, 2, 3, …) up to 170 in the input field. You can also click one of the quick-pick buttons for common values.
- Click Calculate: The calculator instantly computes n! and displays the result.
- Review the breakdown: Below the result, you'll see the step-by-step multiplication (n × (n-1) × … × 1), the number of digits, and the trailing zeros count.
- Copy if needed: Use the "Copy Results" button to grab a formatted summary you can paste into homework, reports, or notes.
That's it. No signup, no email, no waiting. The entire process takes seconds.
Factorial formula and properties
The factorial function is one of the most fundamental operations in combinatorics and probability theory. Here are the key formulas and properties.
For n = 0: 0! = 1 (by definition)
For n ≥ 1: n! = n × (n−1)!
Example: 5! = 5 × 4! = 5 × 24 = 120
Example: For 100!, floor(100/5) + floor(100/25) + floor(100/125) = 20 + 4 + 0 = 24 trailing zeros
Factorials grow extremely quickly. 5! is 120, 10! is already 3,628,800, and 20! is over 2.4 quintillion. By the time you reach 170!, the number has 307 digits — which is the largest factorial that fits in a standard double-precision floating-point number.[reference:0]
Factorial values from 0! to 20!
Here's a quick reference table for the most commonly used factorials. Beyond 20!, the numbers get very large very fast.
| n | n! | Digits | Trailing zeros |
|---|---|---|---|
| 0! | 1 | 1 | 0 |
| 1! | 1 | 1 | 0 |
| 2! | 2 | 1 | 0 |
| 3! | 6 | 1 | 0 |
| 4! | 24 | 2 | 0 |
| 5! | 120 | 3 | 1 |
| 6! | 720 | 3 | 1 |
| 7! | 5,040 | 4 | 1 |
| 8! | 40,320 | 5 | 1 |
| 9! | 362,880 | 6 | 1 |
| 10! | 3,628,800 | 7 | 2 |
| 11! | 39,916,800 | 8 | 2 |
| 12! | 479,001,600 | 9 | 2 |
| 13! | 6,227,020,800 | 10 | 2 |
| 14! | 87,178,291,200 | 11 | 2 |
| 15! | 1,307,674,368,000 | 13 | 3 |
| 16! | 20,922,789,888,000 | 14 | 3 |
| 17! | 355,687,428,096,000 | 15 | 3 |
| 18! | 6,402,373,705,728,000 | 16 | 3 |
| 19! | 121,645,100,408,832,000 | 18 | 3 |
| 20! | 2,432,902,008,176,640,000 | 19 | 4 |
Note: The number of digits and trailing zeros continue to grow rapidly. For example, 50! has 65 digits and 12 trailing zeros, while 100! has 158 digits and 24 trailing zeros.[reference:1]
Where factorials are used in real life
Factorials aren't just a math exercise — they show up in several practical fields.
Permutations (arrangements)
The number of ways to arrange n distinct objects in a row is exactly n!. For example, if you have 5 books, there are 5! = 120 different orders you can arrange them on a shelf. If you're organizing a race with 8 runners, there are 8! = 40,320 possible finishing orders.
Combinations (selections)
The number of ways to choose r objects from a set of n objects (where order doesn't matter) uses factorials in the formula: C(n, r) = n! / (r! × (n−r)!). This is used in probability, statistics, and lotteries.
Probability
Factorials appear in probability calculations involving permutations and combinations. For example, the probability of drawing a specific hand in poker involves combinations of 52 cards, which use factorials. The birthday problem — the probability that two people in a group share a birthday — also relies on factorial-based calculations.[reference:2]
Computer science
Factorials are used to analyze the time complexity of algorithms. An algorithm that generates all permutations of n items, for instance, will run in O(n!) time. This is why factorial-time algorithms are considered impractical for large n — 20! is already over 2.4 quintillion operations.
Statistics and distributions
Factorials appear in the formulas for the Poisson distribution, the binomial distribution, and many other probability distributions. They're also part of the gamma function, which extends factorials to non-integer values.[reference:3]
Why use this calculator?
Instant results
No server round-trip means your answer appears the moment you click Calculate. Zero waiting.
Step-by-step breakdown
See exactly how the factorial was computed, digit by digit. Perfect for learning and verifying homework.
100% private
Everything runs in your browser. The number you enter never leaves your device — no server, no logs, no tracking.
Handles large numbers
Up to 170! — that's 307 digits. The calculator handles the full range without breaking a sweat.
No limits
Calculate as many factorials as you want. No daily caps, no watermarks, no "upgrade to pro" nonsense.
Works offline
Once the page loads, you can use the calculator without an internet connection. Bookmark it for exam prep.
Common mistakes to avoid
- Forgetting that 0! = 1. It's the most common surprise in combinatorics, but 0! is defined as 1. This isn't arbitrary — it follows the recursive pattern n! = n × (n−1)!, so 1! = 1 × 0!, which means 0! must equal 1.[reference:4]
- Mixing up n! with n × (n−1)!. n! is not the same as n × (n−1)!. Actually, n! = n × (n−1)!, so they are equal. But n! is not the same as n × n.
- Assuming you can calculate factorials of negative numbers. Factorials are only defined for non-negative integers. There is no such thing as (−5)! in standard mathematics.
- Underestimating how fast factorials grow. 10! is already over 3.6 million, and 20! is over 2.4 quintillion. Factorials grow faster than exponential functions.
- Confusing factorials with exponents. n! is not n². They are completely different operations. 5! = 120, while 5² = 25.