Factorial Calculator (n!)

The factorial of n, written n!, is the product of all whole numbers from 1 to n. 10! = 3,628,800, which has 7 digits and 2 trailing zeros. By definition, 0! = 1.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

What Is a Factorial?

The factorial of a non-negative whole number n is the product of every whole number from 1 up to n: n! = n × (n − 1) × (n − 2) × … × 2 × 1. So 5! = 5 × 4 × 3 × 2 × 1 = 120. It counts the number of different ways to arrange n distinct objects in a row, which is why it is the backbone of permutations, combinations and probability.

Factorials grow astonishingly fast. 10! is already over three million, 20! is about 2.4 quintillion, and 100! has 158 digits. This calculator handles values up to 1,000 and reports the digit count, the trailing zeros and the scientific-notation form, since the full number soon becomes too long to read.

Small Factorials

n012345678910
n!1126241207205,04040,320362,8803,628,800

Factorial Formula

n! = n × (n − 1) × (n − 2) × … × 2 × 1 n! = n × (n − 1)! with 0! = 1 Trailing zeros in n! = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …
  • n is a whole number of 0 or more. Factorials of negative numbers are undefined.
  • The recursive form n! = n × (n − 1)! is how the value is built up one step at a time.
  • 0! = 1 by convention. There is exactly one way to arrange nothing, and it keeps formulas such as C(n, 0) = 1 consistent.
  • Trailing zeros come from factors of 10 = 2 × 5. Since 2s are plentiful, the count is set by the number of factors of 5.

How Is It Calculated? Worked Examples

10!

  1. 10 × 9 = 90; 90 × 8 = 720; 720 × 7 = 5,040.
  2. 5,040 × 6 = 30,240; × 5 = 151,200; × 4 = 604,800.
  3. 604,800 × 3 = 1,814,400; × 2 = 3,628,800.
  4. Result: 10! = 3,628,800, with 7 digits and 2 trailing zeros (⌊10/5⌋ = 2).

Bigger Factorials

nn!DigitsTrailing zeros
202,432,902,008,176,640,000194
2515,511,210,043,330,985,984,000,000266
1009.3326 × 10¹⁵⁷15824

For 100!, the trailing zeros are ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24.

Counting Arrangements

Five people can be lined up in 5! = 120 different orders. Choosing 3 of 10 people in order uses 10! ÷ 7! = 720. See the permutation calculator.

Stirling’s Approximation

For large n, n! ≈ √(2πn) × (n ÷ e)ⁿ. For n = 10 this gives 3,598,696, within 0.83% of the exact 3,628,800. The approximation becomes proportionally more accurate as n grows.

Simplifying Factorial Ratios

Factorials cancel neatly. 11! ÷ 10! = 11, and 8! ÷ 6! = 8 × 7 = 56. Combinations use the same trick: C(10, 3) = 10! ÷ (3! × 7!) = (10 × 9 × 8) ÷ 6 = 120. Cancel the shared tail before multiplying instead of calculating huge factorials.

Shuffling a Deck

A 52-card deck can be arranged in 52! ≈ 8.07 × 10⁶⁷ ways. The chance that a thoroughly shuffled deck comes out in any one specified order, such as sorted, is 1 in 52!. That is why a well-shuffled deck is almost certainly in an order that has never existed before.

How to Use This Factorial Calculator

  1. Enter a whole number n from 0 to 1,000.
  2. Read n! in full (for smaller values), its scientific-notation form, the number of digits and the number of trailing zeros.
  3. Open the steps for the multiplication chain.

For selections and arrangements built from factorials, use the permutation and combination calculator.

Where Factorials Are Used

  • Combinatorics: permutations and combinations are ratios of factorials.
  • Probability: counting outcomes in cards, dice and lotteries, and in the binomial distribution.
  • Calculus and series: Taylor series use terms like xⁿ ÷ n! to approximate functions.
  • Computer science: analysing algorithms that try every ordering of n items.
  • Physics and chemistry: counting arrangements of particles in statistical mechanics.

What Are the Most Common Mistakes With the Factorial Calculator (n!)?

  • Assuming 0! = 0. It is 1.
  • Negative or fractional inputs. The ordinary factorial is defined only for non-negative whole numbers. The gamma function extends it to other values.
  • Confusing n! with (n − 1)! or n × n. 5! = 120, while 5 × 5 = 25.
  • Expecting a readable answer. Beyond about 20!, results exceed what ordinary integers hold, so scientific notation is shown.
  • Forgetting that factorial binds tightly. 2 × 3! = 2 × 6 = 12, not (2 × 3)! = 720.
  • Trailing zeros. They come from factors of 5, not from the number of digits.

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

What is a factorial?

The factorial of n is the product of all whole numbers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.

Why is 0! equal to 1?

There is exactly one way to arrange zero objects, and defining 0! = 1 keeps the formulas for combinations and series consistent.

How many trailing zeros does n! have?

Add ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … For 100! that is 20 + 4 = 24.

How fast do factorials grow?

Faster than any exponential. 10! = 3.6 million, 20! = 2.4 × 10¹⁸ and 52! has 68 digits.

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

The standard factorial is defined only for non-negative integers. The gamma function generalises it to most real and complex numbers, with (1/2)! = √π ÷ 2.

What is the largest factorial this calculator can compute?

Up to 1,000!, which has 2,568 digits. Large results are shown in scientific notation together with the digit count.