Calcamaze

Factorial Calculator

Calculate n! exactly for any n up to 1,000, with the number of digits and Stirling’s approximation.

A whole number from 0 to 1,000.

Result

10!
3,628,800
10 × 9 × 8 × … × 2 × 1
Number of digits
7
In scientific notation
3.6288 × 10^6
Stirling’s approximation √(2πn)(n/e)ⁿ
3,598,696
0.83% below the exact value
Factorials from 0! to 20!
nn!
01
11
22
36
424
5120
6720
75,040
840,320
9362,880
103,628,800
1139,916,800
12479,001,600
136,227,020,800
1487,178,291,200
151,307,674,368,000
1620,922,789,888,000
17355,687,428,096,000
186,402,373,705,728,000
19121,645,100,408,832,000
202,432,902,008,176,640,000

The factorial of a whole number n, written n!, is the product of every whole number from 1 up to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count the ways to arrange things — 5! is the number of orders five books can sit on a shelf — and they appear throughout probability, series and statistics.

This calculator gives n! exactly, digit for digit, for any n up to 1,000 (1,000! has 2,568 digits), together with the digit count, the value in scientific notation and Stirling’s approximation.

Factorials count arrangements: n! is the number of ways to put n different things in order. They grow faster than any exponential, which is why the calculator also shows the number of digits and the answer in scientific notation.

What is a factorial?

The factorial of a whole number n, written n! and read “n factorial”, is the product of all the whole numbers from n down to 1. So 4! = 4 × 3 × 2 × 1 = 24, and by convention 0! = 1. The exclamation mark is apt: factorials grow explosively. 10! is already 3,628,800, 20! passes two quintillion, and 100! has 158 digits — more than the number of atoms in the observable universe (about 10⁸⁰).

Factorials count arrangements. Five books can be shelved in 5! = 120 orders, because there are 5 choices for the first slot, 4 for the second, and so on. That makes them the building block of permutations and combinations, and they turn up in the binomial theorem, Taylor series (e = 1/0! + 1/1! + 1/2! + …) and probability. For large n the exact value is unwieldy, and Stirling’s approximation, n! ≈ √(2πn)(n/e)ⁿ, gives a close estimate — within 1% once n is 9 or more, and ever closer as n grows.

How to use the factorial calculator

  1. Enter a whole number n.
  2. Read n! exactly, its digit count and the approximation.
  3. Scroll the table for small factorials.

Formula

n! = n × (n − 1) × (n − 2) × … × 2 × 1, with 0! = 1

0! is defined as 1 so that formulas such as the number of combinations, n! ÷ (k!(n − k)!), work when k = 0 or k = n. Factorials are only defined for whole numbers; the gamma function extends them to fractions.

Stirling’s approximation, n! ≈ √(2πn) (n/e)ⁿ, is handy when n is large; its relative error is about 1 ÷ 12n, so it is within 1% from n = 9 upwards.

Worked examples

Ways to seat eight guests

n
8
8!
40,320
Number of digits
5
In scientific notation
4.032 × 10^4

8! = 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40,320. Stirling’s formula gives about 39,902, roughly 1% low.

A factorial too big for an ordinary calculator

n
25
25!
15,511,210,043,330,985,984,000,000
Number of digits
26
In scientific notation
1.5511 × 10^25

25! = 15,511,210,043,330,985,984,000,000, a 26-digit number. Most hand calculators show it only as 1.551 × 10²⁵.

Past the limit of floating-point numbers

n
200
200!
78865786736479050355…00000000000000000000 (375 digits)
Number of digits
375
In scientific notation
7.8866 × 10^374

200! has 375 digits and is beyond the range of a double-precision number (which gives up at 170!), but exact integer arithmetic still produces every digit.

How factorials grow

nn!Digits
51203
103,628,8007
151,307,674,368,00013
202,432,902,008,176,640,00019
302652528598…00000033
503041409320…00000065
1009332621544…000000158

How big factorials get

10! is 3,628,800, the number of ways to arrange ten books on a shelf. 52!, the number of ways to shuffle a deck of cards, is about 8.07 × 10⁶⁷, so a well-shuffled deck is almost certainly in an order no deck has ever been in before.

Common mistakes

  • Thinking 0! is 0. It is 1 — there is one way to arrange an empty set, and the formulas for combinations depend on it.
  • Reading n! as a number near n. 10! is not 10 or 100 but 3.6 million.
  • Cancelling carelessly: 10! ÷ 5! is not 2! but 10 × 9 × 8 × 7 × 6 = 30,240.
  • Taking the factorial of a fraction or a negative number. The gamma function handles non-integers; negative whole numbers have no factorial at all.
  • Thinking 0! is 0. By definition 0! = 1, which keeps formulas such as nCr correct.

Frequently asked questions

What is 0 factorial?

0! = 1 by definition. There is exactly one way to arrange nothing, and the definition keeps the combination and permutation formulas valid.

How fast do factorials grow?

Faster than any exponential. 10! is 3.6 million, 20! is about 2.4 × 10¹⁸, 70! already exceeds 10¹⁰⁰ (a googol), and 170! is the largest factorial a standard double-precision number can hold.

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

Not with the ordinary definition. The gamma function gives Γ(x + 1) = x! for non-integers (½! = √π ÷ 2 ≈ 0.886), but negative whole numbers have no factorial.

What is a double factorial?

n!! multiplies every other number: 7!! = 7 × 5 × 3 × 1 = 105. It appears in some probability and physics formulas and is not the same as (7!)!.

Sources

  1. Factorial, Wolfram MathWorld
  2. Stirling’s Approximation, Wolfram MathWorld
  3. Contemporary Mathematics, 7.2 Permutations, OpenStax, Rice University
  4. DLMF §5.11 Asymptotic Expansions (Stirling’s series), NIST Digital Library of Mathematical Functions

Last updated · Calculations checked by automated tests· Editorial policy