Factorial Calculator (n!)

Your values

A whole number such as 100, or a decimal such as 0.5

Whole numbers up to 10,000 are exact; larger ones and decimals use the gamma function.

Result

10!

Number of digits
7
Trailing zeros
2
Scientific notation
3.6288 × 10⁶
Double factorial 10!!
3,840

Step by step

  1. Multiply every whole number from n down to 1:
    10!=10⋅9⋅8⋯2⋅1=362880010!=10\cdot9\cdot8\cdots2\cdot1=3628800
  2. Count the factors of 5 (Legendre's formula) to get the trailing zeros:
    ⌊105⌋=2\left\lfloor\frac{10}{5}\right\rfloor=2

About this tool

The factorial n! multiplies all whole numbers from 1 to n: 5!=5⋅4⋅3⋅2⋅1=1205!=5\cdot4\cdot3\cdot2\cdot1=120. It counts the ways to arrange n different objects in a row, and it appears throughout combinatorics, probability and series such as exe^x. Factorials grow faster than any exponential, so 70! already exceeds a googol. This calculator uses exact big-number arithmetic and shows how the digit count and trailing zeros come about.

How it works

Enter a whole number n to get n factorial, the product of every whole number from 1 to n. You also get the number of digits, the number of trailing zeros, the value in scientific notation and the double factorial n!!. Long results are summarized, and every digit can be expanded and copied.

For n above 10,000, the calculator gives a scientific-notation approximation from the log-gamma function, along with the exact digit count and trailing zeros. Decimal inputs such as 0.5 use the gamma function, which extends the factorial to non-integers.

n!=n⋅(n−1)⋯2⋅10!=1,x!=Γ(x+1)\begin{gathered}n!=n\cdot(n-1)\cdots2\cdot1\\[0.6em]0!=1,\qquad x!=\Gamma(x+1)\end{gathered}

Example

100! has 158 digits and begins 93326215443944. The number of trailing zeros equals the number of factors of 5, because factors of 2 are more plentiful: ⌊1005⌋+⌊10025⌋=20+4=24\left\lfloor\frac{100}{5}\right\rfloor+\left\lfloor\frac{100}{25}\right\rfloor=20+4=24.

For a non-integer, 0.5!=Γ(1.5)=π2≈0.88620.5!=\Gamma(1.5)=\frac{\sqrt{\pi}}{2}\approx0.8862.

Factorial table

Factorials from 0! to 20!, with 25!, 50! and 100!

nn!DigitsTrailing zeros
0110
1110
2210
3610
42420
512031
672031
75,04041
840,32051
9362,88061
103,628,80072
1139,916,80082
12479,001,60092
136,227,020,800102
1487,178,291,200112
151,307,674,368,000133
1620,922,789,888,000143
17355,687,428,096,000153
186,402,373,705,728,000163
19121,645,100,408,832,000183
202,432,902,008,176,640,000194
2515,511,210,043,330,985,984,000,000266
503.04141 × 10⁶⁴6512
1009.33262 × 10¹⁵⁷15824

20! is the largest factorial that fits in a signed 64-bit integer, and 170! is the largest that fits in a double-precision floating-point number, about 7.26×103067.26\times10^{306}.

Assumptions and limits

Exact values are computed for whole numbers up to 10,000 (35,660 digits). From there up to 1,000,000, n! is approximated to six significant figures, while the digit count and trailing zeros stay exact. Decimal inputs between −1,000,000 and 1,000,000 use the gamma function to about ten significant figures; negative whole numbers have no factorial.

Frequently asked questions

Why is 0! equal to 1?

There is exactly one way to arrange zero objects, and an empty product equals 1. It also keeps formulas consistent: n!=n⋅(n−1)!n!=n\cdot(n-1)! with n=1n=1 gives 1!=1⋅0!1!=1\cdot0!, so 0!=10!=1.

How many trailing zeros does n! have?

Count the factors of 5 with Legendre's formula: ⌊n5⌋+⌊n25⌋+⌊n125⌋+⋯\left\lfloor\frac{n}{5}\right\rfloor+\left\lfloor\frac{n}{25}\right\rfloor+\left\lfloor\frac{n}{125}\right\rfloor+\cdots. Each 5 pairs with one of the more common factors of 2 to make a 10. For 1000! that is 200+40+8+1=249200+40+8+1=249.

What is the factorial of a decimal number?

Factorials of non-integers are defined with the gamma function: x!=Γ(x+1)x!=\Gamma(x+1). For example 0.5!=π20.5!=\frac{\sqrt{\pi}}{2} and (−0.5)!=π(-0.5)!=\sqrt{\pi}. The gamma function is undefined at 0 and the negative integers, so (−1)!(-1)! does not exist.

What is a double factorial?

The double factorial n!! multiplies every second number down to 1 or 2: 9!!=9⋅7⋅5⋅3⋅1=9459!!=9\cdot7\cdot5\cdot3\cdot1=945 and 10!!=10⋅8⋅6⋅4⋅2=384010!!=10\cdot8\cdot6\cdot4\cdot2=3840. It is not the factorial of a factorial.

How can I estimate a large factorial?

Stirling's formula n!≈2πn(ne)nn!\approx\sqrt{2\pi n}\left(\frac{n}{e}\right)^{n} is already within 1% for n=10n=10. The number of digits is ⌊log⁡10n!⌋+1\lfloor\log_{10}n!\rfloor+1.

Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
nNumber (n)decimal number, kept exactly as writtenrequired

Examples

  • ?n=20
  • ?n=4.5

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="factorial_calculator"]