Factorial Calculator

Math Updated 30 Oct 2026

Calculates n! (n factorial), the product of all whole numbers from 1 to n, exactly, for any n from 0 to 5,000. Factorials grow extremely fast, so alongside the exact value you get the result in scientific notation, how many digits it has and how many zeros it ends with. Factorials count the ways to arrange n distinct objects in order and appear throughout probability, combinations and permutations.

  • Whole numbers from 0 to 5,000 only.

Formula

n! = n × (n − 1) × (n − 2) × … × 2 × 1, with 0! = 1
  • Recursive form: n! = n × (n − 1)!.
  • The number of trailing zeros is ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …, one for each factor 5 paired with a factor 2.
  • The value is computed exactly with whole-number arithmetic; results with more than 300 digits are shortened on screen.
  • Scientific notation shows the first 10 significant digits, truncated.

10!

Inputs
  • Number n: 10

10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800, which has 7 digits and 2 trailing zeros (⌊10/5⌋ = 2).

Sources & references

  • Factorial
    Wikipedia · Retrieved 30 Oct 2026

    Definition n! = 1 × 2 × … × n, 0! = 1, and Legendre's formula for trailing zeros.

Frequently asked questions

Why is 0! equal to 1?
There is exactly one way to arrange zero objects (do nothing), and the rule n! = n × (n − 1)! needs 1! = 1 × 0!, so 0! must be 1.
What are factorials used for?
Counting arrangements. The number of ways to order n different objects is n!: 5 books can be arranged on a shelf in 5! = 120 ways. Factorials also appear in combinations, permutations and probability.
How many zeros are at the end of 100!?
24: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4.
Can you take the factorial of a fraction or negative number?
Not with the ordinary definition. The gamma function extends it to non-integers (Γ(n + 1) = n!), but negative integers remain undefined.

Related calculators