Free Factorial Calculator (n!)

Free factorial calculator: get the exact value of n! up to 25,000! with every digit, plus the digit count, trailing zeros (Legendre's formula) and sci notation.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideWhat Is a Factorial? n!, 0! = 1, Trailing Zeros and Digit Counts →

About the Factorial Calculator tool

The factorial of n, written n!, is the product of every whole number from 1 to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count the ways to arrange things — 10 books can be ordered on a shelf in 10! = 3,628,800 ways — and they appear throughout probability, combinatorics and calculus. They also grow astonishingly fast: 20! already has 19 digits and 100! has 158, far beyond what ordinary calculators can display exactly.

This calculator computes n! exactly with JavaScript BigInt and a binary-splitting product, so you get every digit up to 25,000! (a number with more than 99,000 digits) in a scrollable box with a copy button. The result card shows the value, its number of digits, the number of trailing zeros and the value in scientific notation. For n between 25,001 and one trillion it switches to Stirling’s formula to give the digit count and leading digits, while the trailing-zero count stays exact.

Trailing zeros are a favourite puzzle, and the steps panel explains them with Legendre’s formula: each zero comes from a factor of 10 = 2 × 5, there are always more 2s than 5s, so you count the multiples of 5, 25, 125 and so on. For 100! that is 20 + 4 = 24 zeros.

How to use Factorial Calculator

  1. Type a whole number into “n (whole number)”, e.g. 25, 100 or 1000.
  2. Read n! in the result card, or its scientific form when the number is long.
  3. Scroll the digits box below the input to see every digit, and use its copy icon to copy them all.
  4. Check the number of digits and trailing zeros in the result rows.
  5. Click “Show steps” to see the product and the Legendre trailing-zero calculation.

Features

Exact up to 25,000!

BigInt arithmetic gives every digit with no rounding, computed in a fraction of a second.

Trailing zeros with Legendre’s formula

An exact count for any n up to 10¹², with the ⌊n/5⌋ + ⌊n/25⌋ + … terms written out.

Digit count and scientific notation

See how many digits n! has and its value as a × 10ᵇ.

Huge n via Stirling’s formula

For n up to one trillion you still get the approximate size and number of digits.

Copy all digits

One click copies the full exact value for use in code, spreadsheets or proofs.

When to use it

  • Count permutations: the number of ways to arrange a deck of 52 cards is 52!.
  • Check combinatorics or probability homework involving nCr and nPr.
  • Solve the classic interview puzzle “how many trailing zeros does 1000! have?”.
  • Get test data with very large integers for a programming exercise.

Frequently asked questions

What is 0 factorial?

0! = 1. It is the empty product, and defining it as 1 makes formulas such as n! = n × (n − 1)! and the number of ways to choose 0 items work consistently.

How many trailing zeros does 100! have?

24. Count the factors of 5: ⌊100/5⌋ = 20 plus ⌊100/25⌋ = 4 gives 24, and there are more than enough factors of 2 to pair with them.

How many digits does 100! have?

158 digits. 1000! has 2,568 digits and 10,000! has 35,660.

Can you take the factorial of a negative number or a decimal?

Not with the ordinary definition. The gamma function extends factorials to non-integers (Γ(n + 1) = n!), but it is undefined at negative integers. This calculator handles whole numbers ≥ 0.

Why do normal calculators show an error for 171!?

171! is larger than 1.8 × 10³⁰⁸, the biggest number standard 64-bit floating point can hold. This tool uses arbitrary-precision integers instead.

Related tools