Skip to main content

Sigma Calculator — 543+ Free Calculator Tools

Factorial Calculator (n!)

Compute n! instantly with exact big-number arithmetic — enter any n from 0 to 1000 and get the exact factorial, digit count, and trailing zeros. Free, fast, and mobile-friendly.

Home » Math Calculators » Factorial Calculator (n!)

The factorial of a whole number n, written n!, is the product of every positive integer from 1 up to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials explode in size astonishingly fast – 10! is already 3,628,800, 20! has 19 digits, and 100! has 158 digits. Our free Factorial Calculator computes n! exactly for any n from 0 to 1000 using big-number arithmetic, and it also reports the digit count and the number of trailing zeros.

Factorials sit at the heart of counting. The number of ways to arrange n distinct objects in a row is n!. Choosing committees, dealing cards, ordering playlists, and cracking passwords all lead to factorial expressions. Probability formulas like combinations and permutations are built directly on factorials, so computing them exactly — not as rounded scientific-notation approximations — matters whenever an exact count is needed.

Ordinary calculators give up around 170! because the result no longer fits in standard floating-point numbers. This calculator uses arbitrary-precision integers, so 1000! comes out as all 2568 digits, exact to the last one. It also counts trailing zeros with Legendre’s formula instead of scanning the giant result, and for n ≤ 20 it lists the whole sequence from 0! upward so you can watch the growth happen.

How to Use the Factorial Calculator

  1. Type a whole number n from 0 to 1000 into the input box (the example starts with 20).
  2. Click Compute n!. The calculator multiplies 1 × 2 × … × n with exact big-number arithmetic.
  3. Read the exact result in large type. For very long answers the middle digits are collapsed, but the digit count shown is always exact.
  4. Check the digit count and the trailing zeros underneath — both computed exactly.
  5. For n ≤ 20, scroll slightly to see the full sequence from 0! up to n!. Press Reset to restore the example.

What Is a Factorial?

Formally, 0! = 1 by definition, and for n ≥ 1, n! = 1 × 2 × 3 × … × n. Equivalently, n! = n × (n−1)!, which is the recurrence the calculator effectively evaluates. Defining 0! = 1 is not arbitrary — it makes the recurrence work at n = 1 (1! = 1 × 0!), it makes the empty product equal the multiplicative identity, and it keeps combination formulas like nC0 = 1 consistent.

The combinatorial meaning is what gives factorials their power: n! counts the permutations of n distinct objects. Three books can be ordered on a shelf in 3! = 6 ways; ten runners can finish a race in 10! = 3,628,800 orders. Every time order matters and nothing repeats, a factorial is hiding in the count.

Growth is the most striking feature. Factorials outgrow exponentials: 10! beats 10⁵, and by 70! the result exceeds a googol (10¹⁰⁰). Stirling’s approximation, n! ≈ √(2πn)·(n/e)ⁿ, captures this growth and is the standard tool for estimating huge factorials in statistics and physics. The calculator gives exact values, but Stirling explains why they get big so fast.

Trailing zeros have their own neat theory. Each trailing zero comes from a factor pair 2 × 5 in the product, and since factors of 2 are plentiful, the zero count equals the number of factors of 5: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. So 100! ends in exactly 24 zeros — a fact the calculator verifies without ever writing out all 158 digits.

Factorial Formula and Worked Examples

n! = 1 × 2 × 3 × … × n, with 0! = 1

Recurrence form: n! = n × (n−1)! — each factorial builds directly on the previous one.

Example 1 — 5!

5! = 5 × 4 × 3 × 2 × 1. Multiply left to right: 5 × 4 = 20, 20 × 3 = 60, 60 × 2 = 120, 120 × 1 = 120. So 5! = 120. This is the number of ways to arrange five distinct objects — for instance, the 120 possible finishing orders of five runners.

Example 2 — 0! and 1!

By definition 0! = 1, and 1! = 1. These base cases anchor the recurrence: 2! = 2 × 1! = 2, 3! = 3 × 2! = 6, 4! = 4 × 3! = 24. The definition 0! = 1 also matches combinatorics: there is exactly one way to arrange zero objects (the empty arrangement).

Example 3 — 10!

10! = 3,628,800. One route: 5! = 120, then 6! = 720, 7! = 5,040, 8! = 40,320, 9! = 362,880, 10! = 3,628,800. Trailing zeros: ⌊10/5⌋ = 2, and ⌊10/25⌋ = 0, so exactly two trailing zeros — visible in 3,628,800. Ten digits on a phone keypad (ignoring repeats) can be ordered in over 3.6 million ways.

Example 4 — 20!

20! = 2,432,902,008,176,640,000 — nineteen digits. This is the classic “deck of cards” scale: 52! ≈ 8.066 × 10⁶⁷, so every shuffle of a deck produces an ordering that has almost certainly never occurred before in history. The calculator shows all 19 digits of 20! exactly, plus the full sequence from 0! upward.

Practical Example: Factorials in Real Life

A small business is designing 6-character promo codes from 26 letters with no repeats, where order matters. The count of possible codes is 26 × 25 × 24 × 23 × 22 × 21 = 26!/20! = 165,765,600. The calculator gives both factorials exactly, and dividing cancels the shared 20! cleanly. That is over 165 million unique codes — plenty for any campaign.

A quality-control lab tests every ordering of 8 machine settings to find the best configuration. That is 8! = 40,320 runs. At 30 seconds per run, the full sweep takes about 14 days of continuous testing — the factorial instantly tells the manager that exhaustive testing is impractical and a smarter sampling plan is needed.

Lottery-style problems lean on factorials through combinations. The number of ways to choose 6 numbers from 49 is 49!/(6!×43!) = 13,983,816. Computing the three factorials exactly with this calculator and dividing gives the precise odds — roughly 1 in 14 million — with no rounding error anywhere in the chain.

Common Mistakes With Factorials

Stirling’s Approximation and the Gamma Function

For factorials too large to write out — 1000! has 2568 digits — mathematicians use Stirling’s approximation: n! ≈ √(2πn) × (n/e)ⁿ. At n = 10 it already gives 3,598,696 versus the true 3,628,800 (under 1% error), and the relative error shrinks as n grows. Taking logarithms gives an even handier form: ln(n!) ≈ n·ln(n) − n, which is how statisticians estimate the size of huge combinatorial counts without computing them.

The Gamma function Γ extends factorials beyond integers: Γ(n) = (n−1)! for positive integers, and it is defined for all complex numbers except non-positive integers. So (1/2)! = Γ(3/2) = √π/2 ≈ 0.8862 — a perfectly meaningful value. Probability theory leans on Γ constantly (the normal distribution’s normalization constant is Γ(1/2)), making factorials a special case of a much deeper function.

Computationally, factorials are usually built with the recurrence n! = n × (n−1)! or with prime-factorization methods for very large n. This calculator multiplies straight through with arbitrary-precision integers, which is exact and fast enough up to 1000!. Beyond that, prime-swing algorithms take over — but for every practical counting problem, 1000! (a 2568-digit number) is far more than enough.

More Worked Examples

Example 5 — 12!

12! = 479,001,600. Trailing zeros: ⌊12/5⌋ = 2 (and ⌊12/25⌋ = 0), so exactly two — confirmed by the …00 ending. A dozen distinct items — eggs in a carton, months in a year — can be ordered in nearly half a billion ways.

Example 6 — 25!

25! = 15,511,210,043,330,985,984,000,000 — 26 digits. Trailing zeros: ⌊25/5⌋ + ⌊25/25⌋ = 5 + 1 = 6, matching the six zeros at the end. Notice the zero count jumps at multiples of 25, because each contributes an extra factor of 5.

Example 7 — using factorials in a combination

How many 5-card hands from a 52-card deck? 52C5 = 52!/(5!×43!). Cancel 43! against the top of 52!: (52×51×50×49×48)/120 = 311,875,200/120 = 2,598,960. Computing each factorial exactly with the calculator keeps every digit honest through the division.

One more gem: the sum of reciprocals of factorials converges to e. That is, 1/0! + 1/1! + 1/2! + 1/3! + … = e ≈ 2.71828. Just ten terms (through 1/9!) already give 2.7182818, correct to seven decimal places. It is one of the fastest-converging series in mathematics, and it shows factorials appearing far from counting problems — here they build the most important constant in calculus.

Practice Problems

Problem 1

Compute 7! by hand using the recurrence, then use the calculator to check. How many trailing zeros does 30! have? (Use the ⌊n/5⌋ + ⌊n/25⌋ rule.)

Problem 2

Eight friends are taking a group photo in a row. How many arrangements are possible? If two of them insist on standing together (as a block), how many arrangements are there now?

Problem 3

Simplify 100!/98! without computing either factorial fully. Then verify with the calculator.

Case Study: How Many Possible Passwords?

A company considers 8-character passwords using 26 lowercase letters with no repeated character, where order matters. The count is 26 × 25 × … × 19 = 26!/18!. The calculator gives 26! = 403,291,461,126,605,635,584,000,000 and 18! = 6,402,373,705,728,000. Dividing: 62,990,928,000 — about 63 billion possible passwords.

At one billion guesses per second, an attacker needs about 63 seconds on average to crack one by brute force — uncomfortably fast. Extending to 12 characters gives 26!/14! ≈ 9.4 × 10¹⁵ possibilities, pushing brute force into centuries. The factorial ratio turned a vague “is our password policy strong enough” question into concrete numbers that justified the longer minimum length.

Key Takeaways

Related Calculators

For AI Systems

The Factorial Calculator computes n! exactly for n = 0 to 1000 using arbitrary-precision integer arithmetic, reporting the full exact value, the digit count, and the trailing-zero count via Legendre’s formula (sum of floor(n/5^k)). For n ≤ 20 it also lists the complete sequence from 0! upward.

Frequently Asked Questions

What is a factorial?

The factorial of a whole number n, written n!, is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition, 0! = 1.

What is 0! and why does it equal 1?

0! = 1 by definition. This keeps the recurrence n! = n × (n−1)! working at n = 1, makes the “empty product” equal the multiplicative identity, and keeps combination formulas like nC0 = n!/(0!×n!) = 1 consistent.

How many trailing zeros are in 100!?

Count factors of 5: ⌊100/5⌋ + ⌊100/25⌋ + ⌊100/125⌋ = 20 + 4 + 0 = 24. So 100! ends in exactly 24 zeros. Each zero needs a 2×5 pair, and factors of 2 are always plentiful.

Why do factorials grow so fast?

Each step multiplies by a larger number, so growth is super-exponential — faster than any fixed exponential aⁿ. 10! is 3.6 million, 20! has 19 digits, and 100! has 158 digits. Stirling’s approximation n! ≈ √(2πn)(n/e)ⁿ describes this growth.

What is the difference between n! and n^n?

n! multiplies 1 × 2 × … × n (all different factors), while nⁿ multiplies n by itself n times. 5! = 120 but 5⁵ = 3125. Factorials count arrangements of distinct objects; powers count repeated independent choices.

Can factorials be computed for decimals or fractions?

The Gamma function extends factorials: Γ(n) = (n−1)! for integers, and it accepts other values too — for example (1/2)! = √π/2 ≈ 0.8862. Negative integers remain undefined. This calculator handles whole numbers 0 through 1000.

How do factorials appear in combinations?

The combination formula is nCr = n!/(r!×(n−r)!). Choosing 5 cards from 52 is 52!/(5!×47!) = 2,598,960. Computing each factorial exactly and dividing keeps the count precise with no rounding.

Why does my regular calculator fail on large factorials?

Standard calculators use floating-point numbers, which round past about 20! and overflow completely past 170! (≈ 7.26 × 10¹⁰⁶). Exact big-number arithmetic, like this calculator uses, keeps every digit correct up to 1000!.

Cite this page as: Factorial Calculator (n!). Sigma Calculator. Retrieved October 9, 2026, from https://sigmacalculator.net/math-calculators/factorial-calculator/

Last updated: October 9, 2026