Skip to main content

DigitalCalculators.net

Factorial Calculator

Find n! exactly for any whole number up to 5,000, with the number of digits, trailing zeros, scientific notation and the steps.

Results

ItemValue

Steps

StepWorking

Exact value

Exact for every whole number from 0 to 5,000. Very large factorials have thousands of digits, so the full value is shown in a scrolling box. By definition, 0! = 1.

Quick Answer

n! (n factorial) is the product of all whole numbers from 1 to n. 5! = 5 × 4 × 3 × 2 × 1 = 120, and 20! = 2,432,902,008,176,640,000. 100! has 158 digits and ends in 24 zeros.

Last updated: 3 November 2026 ·How we calculate this: exact multiplication with big integers

Table of Contents

How This Factorial Calculator Works

Enter a whole number n from 0 to 5,000. The calculator multiplies every whole number from 1 up to n using exact big-integer math, so no digits are lost. It shows the result, how many digits it has, how many zeros it ends in, the value in scientific notation and, for smaller n, how close Stirling's approximation comes. The full number appears in a scrolling box you can copy.

Quick explanation: factorials grow extremely fast.

  • 5! = 120
  • 10! = 3,628,800
  • 0! = 1, by definition

How to Use the Factorial Calculator

  1. Enter a whole number from 0 to 5,000.
  2. Press Calculate.
  3. Read n!, its digits and trailing zeros.
  4. See the scientific notation for very large values.
  5. Copy the exact value from the box if you need it.

Core Formulas

  • Factorial: n! = n × (n − 1) × ... × 2 × 1
  • Recursive form: n! = n × (n − 1)!, with 0! = 1
  • Trailing zeros: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ...
  • Stirling's approximation: n! ≈ √(2πn) × (n/e)n

Key Terms

  • Factorial: the product of all whole numbers from 1 to n, written n!.
  • Permutation: an ordered arrangement of items.
  • Trailing zeros: the zeros at the end of a number.
  • Stirling's approximation: a formula that estimates n! for large n.
  • Gamma function: an extension of the factorial to non-whole numbers.

Worked Example

How many zeros are at the end of 100!?

  • ⌊100/5⌋ = 20 multiples of 5
  • ⌊100/25⌋ = 4 extra fives from 25, 50, 75 and 100
  • Total = 20 + 4 = 24 trailing zeros

Real-Life Examples

  • Seating: 8 people can sit in a row in 8! = 40,320 ways.
  • Card shuffles: a 52-card deck can be ordered in 52! ways, a 68-digit number.
  • Lottery odds: combinations, which use factorials, give the chance of winning.
  • Puzzles: count the ways to arrange the letters of a word.

Factorial vs Exponent

  • Factorial: multiplies decreasing numbers, n × (n − 1) × ...
  • Exponent: multiplies the same number, n × n × ...
  • Growth: n! grows faster than any fixed base to the n, such as 10n, for large n.

Factorials from 0 to 21

nn!nn!
011139,916,800
1112479,001,600
22136,227,020,800
361487,178,291,200
424151,307,674,368,000
51201620,922,789,888,000
672017355,687,428,096,000
75,040186,402,373,705,728,000
840,32019121,645,100,408,832,000
9362,880202,432,902,008,176,640,000
103,628,8002151,090,942,171,709,440,000

Where Factorials Are Used

  • Arrangements: n! counts the ways to order n different items.
  • Combinations: n! appears in nCr = n! ÷ (r!(n − r)!).
  • Probability: the binomial and Poisson formulas use factorials.
  • Series: ex and sin x use factorials in their Taylor series.

Counting Arrangements With Factorials

The main everyday use of n! is counting orders. If you have n different items, there are n choices for the first place, n − 1 for the second, and so on, which multiplies out to n!.

  • All items: 6 books on a shelf can be arranged in 6! = 720 ways.
  • Only some items: to fill 3 places from 10 people, use 10! ÷ 7! = 720.
  • Repeated items: the letters of BOOK can be arranged in 4! ÷ 2! = 12 ways, because the two Os look the same.

When order does not matter, divide again by the factorial of the group size. That gives combinations, which our Combination Calculator works out step by step. Both ideas start from the same simple factorial.

Common Mistakes to Avoid

  • Thinking 0! = 0. It equals 1.
  • Using decimals. The factorial here is for whole numbers. Non-whole values use the gamma function.
  • Rounding big results. Normal calculators lose digits after about 15 to 17 figures.
  • Counting zeros by multiples of 10 only. Each factor of 5 paired with a 2 adds a zero.
  • Confusing n! with n!!. The double factorial multiplies every other number.

Frequently Asked Questions

The product of all positive whole numbers up to n. 4! = 4 × 3 × 2 × 1 = 24.

1. This keeps formulas like nCr working.

3,628,800.

158.

24.

No. Factorials are defined for whole numbers 0 and up.

Not with this definition. The gamma function extends it, with Γ(n + 1) = n!.

Each step multiplies by a larger number.

5,000!, which has over 16,000 digits.

Add ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ and so on.

n! ≈ √(2πn)(n/e)ⁿ, which gets more accurate as n grows.

nCr = n! ÷ (r!(n − r)!). See our Combination Calculator.

References & Sources

SourceUsed ForLink
Wikipedia, Factorial Definition, growth, trailing zeros and Stirling's approximation. https://en.wikipedia.org/wiki/Factorial
OEIS, A000142: Factorial numbers The sequence of factorials. https://oeis.org/A000142