Factorial Calculator

Find the exact value of n! (n factorial) for any whole number up to 5,000, or a multifactorial such as n!!, with every step shown.

20!2,432,902,008,176,640,000

Whole number from 0 to 5,000.

Leave at 1 for a normal factorial.

20!

2,432,902,008,176,640,000

  • Number of digits19
  • Scientific notation2.432902008 × 10¹⁸
  • Trailing zeros4
  • Factors multiplied20

Computed exactly with integer arithmetic. 0! = 1 by convention (empty product). Trailing zeros equal ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … (Legendre's formula).

How this was calculated

  1. A factorial (written with !) means: multiply the number by every whole number below it, all the way down to 1.n! = n × (n − 1) × … × 1
  2. Write out the numbers to multiply, starting from your number.20! = 20 × 19 × 18 × 17 × … × 1
  3. This is the answer.20!Answer: 2,432,902,008,176,640,000 (19 digits)

Factorials in simple words

A factorial means multiplying a whole number by every whole number below it, down to 1. It is written with an exclamation mark: 5! is said “five factorial”.

Example: 5! = 5 × 4 × 3 × 2 × 1. Step by step, 5 × 4 = 20, 20 × 3 = 60, 60 × 2 = 120 and 120 × 1 = 120. So 5! = 120.

Factorials count how many ways you can put things in order. Three friends can stand in a line in 3! = 3 × 2 × 1 = 6 different ways.

Factorials grow very fast. 10! is already 3,628,800, which is why the calculator also shows how many digits the answer has.

Definitions

n! = n × (n − 1) × … × 2 × 1, and 0! = 1 because it is an empty product. In terms of the gamma function, n! = Γ(n + 1).

A multifactorial counts down in steps of k: n!(k) = n × (n − k) × (n − 2k) × …, stopping at the last positive term. The double factorial n!! uses k = 2, so 7!! = 7 × 5 × 3 × 1 = 105 and 8!! = 8 × 6 × 4 × 2 = 384. It is not the same as (n!)!.

Worked example

20! = 20 × 19 × … × 1 = 2,432,902,008,176,640,000. That is 19 digits with 4 trailing zeros, or about 2.432902008 × 10¹⁸.

100! has 158 digits. By Legendre's formula it has ⌊100/5⌋ + ⌊100/25⌋ = 24 trailing zeros, because each zero needs a factor of 5 paired with a factor of 2.

Exact arithmetic and limits

Every digit is computed with exact integer arithmetic; nothing is rounded. When the result is too long for the headline, the headline shows scientific notation and the table below lists every digit, with a CSV download. The limit of n = 5,000 (a 16,326-digit answer) keeps the page fast.

How to use the Factorial Calculator

Enter n and, optionally, the step.

  1. Enter n

    Type a whole number from 0 to 5,000.

  2. Choose the step

    Leave k = 1 for n!, or use 2 for a double factorial, 3 for a triple factorial, and so on.

  3. Read the result

    See the exact value, digit count, trailing zeros and scientific notation.

Frequently asked questions

Why is 0! equal to 1?

0! is the empty product, and defining it as 1 keeps formulas such as n! = n × (n − 1)! and C(n, 0) = 1 consistent.

How many digits does 1000! have?

2,568 digits, with 249 trailing zeros.

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

Not with this tool. For non-integers, n! extends to the gamma function Γ(n + 1). It is undefined at negative integers.

References

Last updated . Results are estimates for informational purposes only.