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.

10! =
—
Number of Digits
—
Trailing Zeros
—

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

  1. 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.
  2. Click Calculate: The calculator instantly computes n! and displays the result.
  3. 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.
  4. 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.

Definition
n! = n × (n−1) × (n−2) × … × 2 × 1

For n = 0: 0! = 1 (by definition)
For n ≥ 1: n! = n × (n−1)!
Recursive property
n! = n × (n−1)!

Example: 5! = 5 × 4! = 5 × 24 = 120
Trailing zeros formula
Trailing zeros in n! = floor(n/5) + floor(n/25) + floor(n/125) + …

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!110
1!110
2!210
3!610
4!2420
5!12031
6!72031
7!5,04041
8!40,32051
9!362,88061
10!3,628,80072
11!39,916,80082
12!479,001,60092
13!6,227,020,800102
14!87,178,291,200112
15!1,307,674,368,000133
16!20,922,789,888,000143
17!355,687,428,096,000153
18!6,402,373,705,728,000163
19!121,645,100,408,832,000183
20!2,432,902,008,176,640,000194

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.

Frequently asked questions

A factorial, written as n!, is the product of all positive integers from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.
0! is defined as 1. This follows the pattern that n! = n × (n−1)!, so 1! = 1 × 0!, which means 0! must equal 1 for the pattern to hold. It also matches the combinatorial fact that there is exactly one way to arrange zero objects.
170! is the largest factorial that can be represented as a standard double-precision floating-point number. Beyond 170!, the result overflows standard numeric types and is typically expressed in scientific notation or with big-integer arithmetic. This calculator supports up to 170!.
Factorials are used to count permutations (arrangements of objects), combinations (selections), in probability calculations, in the binomial theorem, and in computer science for analyzing algorithm complexity. They're also used in statistics for distributions like Poisson and binomial.
No. Factorials are only defined for non-negative integers. The factorial of a negative integer is undefined in standard mathematics, though there is an extension called the gamma function that generalizes factorials to non-integers.
Trailing zeros are the zeros at the end of a factorial number. They come from pairs of factors 2 and 5 in the factorial product. Since 5 is the limiting factor, the number of trailing zeros equals the number of times 5 divides n!. The formula is floor(n/5) + floor(n/25) + floor(n/125) + …
Yes, completely free. No signup, no watermark, no hidden charges. Use it as many times as you want, for homework, work, or personal projects.
Absolutely. Everything runs in your browser using JavaScript. The number you enter never leaves your device — there is no server processing, no logging, and no data storage. Close the tab and it's gone.