Factorial Calculator

A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call

Free factorial calculator. Work out n! exactly for any number up to 20,000, with the number of digits, trailing zeros and scientific notation.

Digits
0
Trailing zeros
0
Scientific notation
0

Full answer

Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.

How to use the factorial calculator

  1. Enter a whole number n, from 0 up to 20,000.
  2. Read the result. The factorial calculator shows n!, the number of digits, how many zeros it ends in, and its scientific notation form.
  3. Copy the full answer from the box below. For large n, every digit is there.

The calculation is exact. 52! has 68 digits, and the factorial calculator gives all of them, not a rounded 8.07 × 10^67.

What a factorial is

The factorial of n, written n!, is the product of all whole numbers from 1 up to n:

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

  • 1! = 1
  • 3! = 3 × 2 × 1 = 6
  • 5! = 120
  • 10! = 3,628,800
  • 20! = 2,432,902,008,176,640,000

By definition, 0! = 1. That isn't arbitrary: it keeps formulas such as combinations consistent (there's exactly one way to arrange zero objects).

Why factorials grow so fast

Each step multiplies by a bigger number, so factorials grow faster than powers. 10! is about 3.6 million; 20! is about 2.4 quintillion; 70! is more than a googol (10^100). That's why many calculators show an error above 170!: the result is bigger than the largest number they can store. The factorial calculator uses exact big-integer arithmetic, so it has no such limit up to 20,000! (which has 77,338 digits).

Factorials and arrangements

n! counts the ways to arrange n different things in order:

  • 3 books on a shelf: 3! = 6 orders.
  • 10 people in a queue: 10! = 3,628,800 orders.
  • A deck of 52 cards: 52! ≈ 8.07 × 10^67 possible shuffles. That number is so large that every properly shuffled deck has almost certainly never existed in that order before.

Factorials are also the building blocks of combinations and permutations. To count selections where you choose only some of the items, use the combination calculator.

Trailing zeros

How many zeros does 100! end in? Each trailing zero comes from a factor of 10 = 2 × 5. There are always more 2s than 5s, so count the 5s:

Zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …

For 100: 20 + 4 = 24 trailing zeros. This is a classic interview and competition question, and the factorial calculator shows the answer for any n.

Number of digits

The number of digits in n! is ⌊log₁₀(n!)⌋ + 1. For 100!, that's 158 digits. The factorial calculator counts them directly from the exact result. For a feel for logarithms, the log calculator works out log₁₀ of any number.

Stirling's approximation

For large n, there's a famous approximation:

n! ≈ √(2πn) × (n/e)^n

For n = 10, it gives about 3,598,696, within 1% of the true 3,628,800, and the relative error shrinks as n grows. It's how mathematicians estimate factorials too large to compute directly, and it appears throughout probability and physics.

Where factorials are used

  • Probability and statistics: counting outcomes, the binomial distribution, the Poisson distribution.
  • Combinatorics: permutations and combinations.
  • Calculus: Taylor series, such as e^x = 1 + x + x²/2! + x³/3! + …
  • Computer science: analysing algorithms (sorting, brute-force search) and testing big-number libraries.
  • Puzzles and competitions: trailing zeros, digit sums and divisibility.
  • Double factorial (n!!): the product of every other number: 7!! = 7 × 5 × 3 × 1 = 105.
  • Gamma function: extends factorials to non-whole numbers, with Γ(n) = (n − 1)! for whole numbers. Γ(1/2) = √π.
  • Primorial: the product of primes up to n.

The factorial calculator handles the standard factorial of whole numbers.

Factorials and prime factors

Legendre's formula, which counts the 5s for trailing zeros, works for any prime: the exponent of prime p in n! is ⌊n/p⌋ + ⌊n/p²⌋ + …. For example, 10! = 2⁸ × 3⁴ × 5² × 7. You can check with the prime factorization calculator by entering 3628800.

Tips

  • Remember 0! = 1.
  • Negative numbers and fractions don't have ordinary factorials; the calculator asks for a whole number of 0 or more.
  • For huge results, use the scientific notation form for a quick sense of size, and copy the full answer when you need every digit.
  • For powers rather than factorials, use the exponent calculator.

Privacy and accuracy

Your numbers stay in your browser. The factorial calculator multiplies with exact big integers, counts trailing zeros with Legendre's formula, and uses no AI, so results are always exact and always the same. Students, teachers, programmers and puzzle fans use it free on any device.

Factorials in spreadsheets and code

To check results elsewhere:

  • Excel and Google Sheets: =FACT(10) gives 3,628,800, but results above 170! show an error, and from about 21! they're rounded.
  • JavaScript: a loop with BigInt gives exact results; ordinary numbers lose precision after 18!.
  • Python: math.factorial(100) is exact for any size.

The factorial calculator gives exact results up to 20,000!, so it's a reliable reference when testing code or checking homework.

Sums and estimates

Factorials appear in the series for e: 1 + 1/1! + 1/2! + 1/3! + … = 2.71828…. Adding just ten terms gives e to seven decimal places, because factorials grow so quickly that later terms become tiny. The same speed of growth means brute-force searches over all orderings become impossible beyond about 15 to 20 items, which is why algorithms for scheduling and routing use cleverer methods.

Divisibility tricks

Since n! includes every number from 1 to n as a factor, n! is divisible by every whole number up to n. So 10! is divisible by 7, 8 and 9, and n! + 2, n! + 3, …, n! + n are all composite, a neat way to show there are arbitrarily long runs of numbers with no primes. The factorial calculator lets you see these huge numbers in full.

Quick reference

  • n!: the product of whole numbers from 1 to n.
  • 0! = 1 and 1! = 1.
  • Trailing zeros: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …
  • Permutations of n items: n!.
  • Combinations: n! ÷ (r! × (n − r)!).
  • Stirling's approximation: n! ≈ √(2πn)(n/e)ⁿ.

Small factorials worth knowing

1! = 1, 2! = 2, 3! = 6, 4! = 24, 5! = 120, 6! = 720, 7! = 5,040, 8! = 40,320, 9! = 362,880, and 10! = 3,628,800. Knowing these by heart makes combinatorics and probability homework much faster, and the factorial calculator covers everything beyond them.

Common mistakes

  • Thinking 0! is 0. It's 1.
  • Cancelling factorials incorrectly: 10! ÷ 8! = 10 × 9 = 90, not 10 ÷ 8.
  • Expecting a calculator to show exact digits past about 20!; most can't, but the factorial calculator can.

Factorials and probability

Many probability questions come down to ratios of factorials. The chance that a shuffled deck has all four aces together, the chance of a particular seating order, or the number of distinct anagrams of a word all use them. For anagrams with repeated letters, divide by the factorial of each repeat count: "BANANA" has 6! ÷ (3! × 2!) = 720 ÷ 12 = 60 different arrangements. Use the factorial calculator to get each factorial, then divide. Because the factorial calculator keeps every digit, there's no rounding error even when the numbers are huge, which matters when you then divide one enormous number by another.

Factorials in everyday questions

How many ways can 8 people sit around a table in a row of chairs? 8! = 40,320. How many different orders can 6 songs play in on shuffle? 6! = 720. How many routes visit 10 shops once each? 10! = 3,628,800. Questions like these come up in planning, puzzles and games, and the factorial calculator answers them in a moment, however large the number gets.

Keep it handy

Bookmark this page so the tool is one tap away next time, on your phone or your computer. It loads quickly, works without an account, and keeps nothing you type. If you use it often, add it to your phone's home screen from the browser's share or menu button, and it opens like an app.

A worked example

A student preparing for a coding interview is asked "how many trailing zeros does 100! have?" He enters 100 into the factorial calculator. It shows a 158-digit number, beginning 9.332621 × 10^157, with 24 trailing zeros, matching his hand calculation of ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4.

Out of curiosity he tries 52, the number of cards in a deck: 52! has 68 digits, about 8.065817 × 10^67. He copies the full number into his notes to show his study group how unlikely it is that two shuffled decks have ever matched.

Need more customers from Google?

This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. That is the whole job of DeepRit: a PPC-only agency that sets up and runs Google Ads accounts so every click is accounted for. You keep full ownership of your account, get a written report every week, and can stop at any time. See our pricing or ask for a free audit.

Frequently asked questions

What is a factorial?

n! is the product of all whole numbers from 1 to n. 5! = 5 × 4 × 3 × 2 × 1 = 120.

Why is 0! equal to 1?

There's exactly one way to arrange nothing, and defining 0! = 1 keeps formulas for combinations and series consistent.

How many zeros does 100! end in?

  1. Count the factors of 5: ⌊100/5⌋ + ⌊100/25⌋ = 24.

How many digits does 100! have?

What is the largest factorial this calculator can do?

20,000!, which has 77,338 digits, exactly.

Is the factorial calculator free?

Yes, completely free, with no sign-up.

Free PPC audit

See where your ad budget leaks.

We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.

Book a free audit call 30-minute call · Free · The audit is yours to keep