Skip to content

Factorial Calculator

Work out n! exactly, with every digit, the number of digits and the zeros at the end. Also find double factorials (n!!), factorials of decimals and negatives with the gamma function, subfactorials, falling and rising factorials, and see how close Stirling's shortcut gets.

Multifactorials, falling and rising, reverse, Stirling details, table
What do you want to work out?

Whole numbers give an exact answer (up to 50,000!). Decimals like 4.5 and negatives like −0.5 use the gamma function. 1,000 and 1e6 work too.

Show big answers as
ResultUpdates as you type—Answer—Digits—Zeros at the end—Scientific notationWorking

    How your factorial is worked out

    Your number: multiply every whole number down to 1.

    1. 1

      Line them up

      10 down to 110 numbers10 × 9 × … × 1

    2. 2

      Multiply

      10 × 9 = 90 …= 3,628,800

    3. 3

      Count digits and 0s

      7 digits2 zeros at the endone per 5 in it

    4. 4

      Check with Stirling

      √(2πn) × (n/e)ⁿ≈ 3.599 × 10⁶0.83% low

    Read more: the formulas, worked examples, a table and notes

    A factorial multiplies a whole number by every whole number below it, down to 1. It counts the ways to put things in order: the first spot has n choices, the next has n − 1, and so on. Factorials grow faster than any power: 10! is over 3.6 million, 20! is over 2.4 billion billion, and 70! is bigger than a googol (10100).

    The formula

    n! = n × (n − 1) × (n − 2) × … × 2 × 1, and 0! = 1
    Zeros at the end of n! = ⌊n ÷ 5⌋ + ⌊n ÷ 25⌋ + ⌊n ÷ 125⌋ + … (⌊ ⌋ means round down)
    Double factorial: n!! = n × (n − 2) × (n − 4) × … down to 1 or 2; step k: n × (n − k) × (n − 2k) × …
    Decimals and negatives: x! = Γ(x + 1), the gamma function
    Subfactorial: !n = n × !(n − 1) + (−1)n, with !0 = 1 and !1 = 0; also n! ÷ e rounded
    Falling: x × (x − 1) × … × (x − k + 1). Rising: x × (x + 1) × … × (x + k − 1)
    Stirling's approximation: n! ≈ √(2πn) × (n ÷ e)n, closer still × (1 + 1 ÷ (12n))

    Worked example

    10! (the default): 10 × 9 = 90, × 8 = 720, × 7 = 5,040, × 6 = 30,240, × 5 = 151,200, × 4 = 604,800, × 3 = 1,814,400, × 2 = 3,628,800 (and × 1 changes nothing). It has 7 digits. Zeros at the end: ⌊10 ÷ 5⌋ = 2, and 25 is bigger than 10, so there are 2 zeros (from 10 = 2 × 5 and from 5 × 2).

    Stirling check: √(2π × 10) × (10 ÷ 2.71828…)10 ≈ 7.9267 × 453,999.3 ≈ 3,598,696, which is 0.83% below 3,628,800. Times the correction 1 + 1/120 it is about 3,628,685, only 0.0032% low.

    Double factorial: 9!! = 9 × 7 × 5 × 3 × 1 = 945 and 10!! = 10 × 8 × 6 × 4 × 2 = 3,840. Check: 3,840 × 945 = 3,628,800 = 10!.

    Gamma: 4.5! = Γ(5.5) = (945 ÷ 32) × √π ≈ 29.53125 × 1.7724539 ≈ 52.3428.

    Subfactorial: !4 = 4 × !3 + 1 = 4 × 2 + 1 = 9. Four friends in a Secret Santa can draw names in 4! = 24 ways, and in 9 of them nobody gets their own name: 9 ÷ 24 = 37.5%.

    Factorial table

    nn!nn!
    01840,320
    119362,880
    22103,628,800
    361139,916,800
    42412479,001,600
    5120136,227,020,800
    6720151,307,674,368,000
    75,040202,432,902,008,176,640,000

    Notes

    • Whole-number answers are exact up to 50,000! (213,237 digits). Beyond that, up to 1,000,000,000!, the answer comes from Stirling's series and only the figures that can be trusted are shown.
    • Gamma values (decimals and negatives) are worked out numerically with the Lanczos method, good to about 15 significant figures, and shown to 10.
    • The biggest factorial an ordinary calculator or spreadsheet can show is 170! (about 7.26 × 10306); 171! is too big for normal decimal numbers.
    • Where factorials appear: arranging things (n!), choosing groups (nCr = n! ÷ (r! (n − r)!)), probability, the number e = 1/0! + 1/1! + 1/2! + …, and Taylor series in calculus.

    Common questions

    What is a factorial?

    The factorial of a whole number n, written n!, is every whole number from n down to 1 multiplied together. So 5! = 5 × 4 × 3 × 2 × 1 = 120 and 10! = 3,628,800. It counts the ways to put n different things in order: 5 books can stand on a shelf in 120 different orders.

    Why is 0! equal to 1?

    There is exactly one way to arrange nothing: leave it empty. The rule n! = n × (n − 1)! also needs it, because 1! = 1 × 0!, so 0! must be 1. That is why formulas like nCr = n! ÷ (r! × (n − r)!) still work when r is 0 or n.

    How many zeros are at the end of 100!?

    Each zero at the end comes from a 10, which needs a 2 and a 5. There are always more 2s than 5s, so count the 5s: 100 ÷ 5 = 20 numbers have a 5, and 100 ÷ 25 = 4 of them have a second one. 20 + 4 = 24 zeros. 100! has 158 digits in all.

    What is a double factorial (n!!)?

    A double factorial skips every other number: n!! = n × (n − 2) × (n − 4) × … down to 1 or 2. So 9!! = 9 × 7 × 5 × 3 × 1 = 945 and 10!! = 10 × 8 × 6 × 4 × 2 = 3,840. It is not the factorial of a factorial. Multiplying 10!! by 9!! gives 10!.

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

    Not by multiplying, but the gamma function extends it: x! = Γ(x + 1). So 0.5! = √π ÷ 2 ≈ 0.8862 and 4.5! ≈ 52.34. Negative whole numbers such as −1 or −3 have no factorial, because the gamma function shoots off to infinity there. Negative halves are fine: (−0.5)! = √π ≈ 1.7725.

    What is a subfactorial (!n)?

    The subfactorial !n counts the ways to mix up n things so that none ends up in its own place, such as a Secret Santa where nobody draws their own name. !4 = 9 and !10 = 1,334,961. It is n! ÷ e rounded to a whole number, so the chance of a full mix-up is about 1/e, or 36.79%.

    Related calculators

    Permutation and combination calculatornPr and nCr with or without repeats, letters of a word like MISSISSIPPI, circular seating, huge factorials, odds and lists, with steps.Probability calculatorTwo events (and, or, not, neither), repeated tries, Bayes’ theorem, odds, dice, coins and cards, with exact fractions and the working.Scientific calculatorTrig, logs, powers, roots, factorials, nCr and nPr, memory and history, with degrees, radians or gradians and answers as fractions.Exponent calculatorPowers with negative and fractional exponents, exact huge numbers, find the exponent or base, nth roots as surds, logs and antilogs in any base, with steps.

    Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.

    Embed this calculator on your site

    Free to use on your website or blog. Paste this code where you want the calculator to appear. Please keep the credit link.

    Factorial calculator by Zulu Calculator ↗