Free online formula calculators

Factorial Calculator

Calculate n factorial — the product of all whole numbers from 1 to n — exactly, digit for digit.

Factorial Calculator
Result
n!479,001,600
Scientific notation4.79001 × 10^8
Number of digits9
Trailing zeros2

Link to this calculation

Formula

n! = n × (n − 1) × (n − 2) × … × 2 × 1
0! = 1
SymbolMeaning
nA non-negative whole number
n!The factorial of n

How to Use This Calculator

  1. Enter the n.
  2. Press Calculate. Results also update automatically as you type.

Worked Example

Using the values pre-filled in the calculator above:

Inputs
n12
Results
n!479,001,600
Scientific notation4.79001 × 10^8
Number of digits9
Trailing zeros2

About This Calculation

The factorial of n, written n!, is the product of every whole number from 1 up to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition 0! = 1, which keeps formulas in combinatorics consistent: there is exactly one way to arrange zero objects. Factorials are only defined here for non-negative whole numbers; the gamma function extends the idea to fractions.

Factorials grow astonishingly fast. 10! is already 3,628,800, 20! exceeds two quintillion, and 70! is larger than a googol. Ordinary floating-point arithmetic loses exactness beyond about 18! and overflows completely after 170!, so this calculator uses exact big-number arithmetic and prints every digit. The trailing zeros count comes from the factors of 5 in the product (each one pairs with a 2 to make a 10), which is a classic puzzle question.

The main practical use of factorials is counting arrangements. The number of ways to order n distinct items is n!, so a deck of 52 cards can be shuffled into 52! ≈ 8 × 10⁶⁷ different orders. Factorials are the building blocks of the permutation and combination formulas, binomial probabilities and Taylor series for functions such as eˣ and sin x.

Frequently Asked Questions

Why is 0! equal to 1?
There is exactly one way to arrange an empty set. It also makes n! = n × (n − 1)! work for n = 1, and keeps the combination formula correct when choosing all or none of the items.
Can you take the factorial of a negative number or a decimal?
Not with the ordinary definition. The gamma function generalizes it — Γ(n + 1) = n! — and gives values for non-integers, such as (1/2)! = √π / 2, but it is undefined at negative integers.
How many trailing zeros does 100! have?
24. Count multiples of 5 (20) plus multiples of 25 (4), since each contributes a factor of 5 that pairs with a 2 to form a 10.

Category: Math & Algebra. Found a problem with this calculator? Let us know.