Skip to content
The Calculatorz
Arithmetic

Factorial Calculator (n!)

Calculate n! exactly for any whole number up to 5,000, with the number of digits, trailing zeros, double factorial and Stirling's approximation.

Number

Number

How to use this calculator

Enter a whole number n. The calculator computes n factorial exactly using big-integer arithmetic, even when it has thousands of digits, and shows the number of digits, how many zeros it ends with, the double factorial n!! and Stirling's approximation for comparison.

Formula

n! = 1 × 2 × 3 × … × n, with 0! = 1. Double factorial n!! = n × (n − 2) × (n − 4) × … Trailing zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … Stirling's approximation: n! ≈ √(2πn) (n/e)ⁿ.

Calculator credits

Calculator developmentJulia Edwards

Editorial supervision

Expert reviewIfrahMSc Mathematics

Published byThe Calculatorz

Last updated

Read how we research, test, review and correct our calculators in our editorial policy.

Frequently asked questions

What is a factorial?

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

Why is 0! equal to 1?

There is exactly one way to arrange zero objects, and the definition keeps formulas such as n! = n × (n − 1)! consistent.

Where are factorials used?

Counting arrangements and combinations, probability, series in calculus (such as eˣ) and the gamma function.

How many zeros does 100! end with?

24, because 100! contains 24 factors of 5 paired with factors of 2.

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

Not with the basic definition. The gamma function extends factorials to non-integers: Γ(n + 1) = n!.

What is a double factorial?

The product of every second number down to 1 or 2: 7!! = 7 × 5 × 3 × 1 = 105.

References & methodology sources

These sources support the calculator’s formula, definitions, thresholds, units or result interpretation.

  1. OEIS Foundation. (n.d.). A000142: Factorial numbers. The On-Line Encyclopedia of Integer Sequences. View source
  2. Olver, F. W. J., Lozier, D. W., Boisvert, R. F., & Clark, C. W. (Eds.). (2024). NIST Digital Library of Mathematical Functions. National Institute of Standards and Technology. View source
  3. Graham, R. L., Knuth, D. E., & Patashnik, O. (1994). Concrete mathematics (2nd ed.). Addison-Wesley. View source
  4. Hardy, G. H., Wright, E. M., Heath-Brown, D. R., & Silverman, J. H. (2008). An introduction to the theory of numbers (6th ed.). Oxford University Press. View source