Factorial Calculator

By Easy Stat CalcLast updated December 2, 2026

This free factorial calculator, an n factorial calculator that also works as a large factorial calculator, finds n! (n factorial) for any whole number from 0 to 10,000 and shows the exact value, the multiplication steps, the number of digits, the trailing zeros and the prime factors. It can also divide one factorial by another, work backwards to find n from a factorial, handle a double factorial and give the factorial of a decimal such as 0.5. Pick a mode, enter your number and press Calculate.

Loading calculator…

What is a factorial?

A factorial is the product of a whole number and every positive whole number below it. It is written with an exclamation mark, so 5! is read “5 factorial” and means 5 × 4 × 3 × 2 × 1 = 120. The factorial of a number counts the ways to put that many different things in order: n distinct objects can be arranged in an ordered sequence in n! ways, so 5 books on a shelf can be arranged in 5! = 120 ways, and a 52-card deck has 52! possible orders. So what is a factorial in math? A short product that counts orderings, which is why factorials sit at the heart of counting and probability. If you wonder what does factorial mean, or want to define factorial in one line: it is the product of all positive whole numbers up to n, and the factorial definition and factorial meaning are the same thing.

The factorial symbol (!) applies only to the number right before it, so 3 + 2! is 3 + 2 = 5, not 5! = 120. The input must be a non-negative integer (0, 1, 2, 3 and so on). By definition 0! = 1 and 1! = 1, and the factorial numbers then grow very fast: 1, 2, 6, 24, 120, 720 and so on. 20! is already 2,432,902,008,176,640,000.

Factorial formula

The factorial formula is n! = n × (n − 1) × (n − 2) × … × 3 × 2 × 1. Written as a function, the factorial function takes a whole number and returns this product, and all factorial math rests on it. The same rule can be written as the factorial equation n! = n × (n − 1)!, called a recursion: each factorial is the number times the factorial just below it. For example, 13! = 13 × 12! = 13 × 479,001,600 = 6,227,020,800.

Three factorial properties are worth remembering:

  • n! has every number from 1 to n as a factor, so it divides evenly by each of them.
  • (n + 1)! = (n + 1) × n!, so adding 1 to n multiplies the answer by n + 1.
  • n! picks up more zeros at the end as n grows, one for each pair of 2 and 5 in the product (see the section on large factorials).

These factorial rules are all you need to work with the numbers below.

Factorial formula n! = n × (n − 1) × … × 1 with 5! as boxes 5, 4, 3, 2, 1 and running products 5, 20, 60, 120
How a factorial is built: 5! multiplies 5 by each whole number below it, and each factorial equals n times the factorial just below it.

How to calculate a factorial step by step

How to calculate factorial values by hand comes down to one habit: multiply down to 1. To calculate the factorial of 9, write the product and multiply from the left, one number at a time:

  1. Write 9! = 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1.
  2. 9 × 8 = 72.
  3. 72 × 7 = 504.
  4. 504 × 6 = 3,024.
  5. 3,024 × 5 = 15,120.
  6. 15,120 × 4 = 60,480.
  7. 60,480 × 3 = 181,440.
  8. 181,440 × 2 = 362,880. Multiplying by 1 changes nothing, so 9 factorial is 362,880. That is how to do factorial problems on paper.

A shortcut is to start from a factorial you already know. Since 6! = 720, 7 factorial is 7 × 720 = 5,040, and since 8! = 40,320, 9! = 9 × 40,320 = 362,880 again.

Factorials from 0 to 20

The factorial table below lists 0! to 20!, each written as n × (n − 1)! so you can see how one row builds the next. In words: 3 factorial is 6, 4 factorial is 24, 5 factorial is 120, 6 factorial is 720, 7 factorial is 5,040, 8 factorial is 40,320, 9 factorial is 362,880, 10 factorial is 3,628,800, 11 factorial is 39,916,800 and 12 factorial is 479,001,600. Put the other way round, the factorial of 3 is 6, the factorial of 4 is 24, the factorial of 5 is 120, the factorial of 6 is 720, the factorial of 7 is 5,040 and the factorial of 8 is 40,320.

Factorials from 0! to 20! with the value of each
nBuilt from the row aboven!
0By definition1
11 × 0!1
22 × 1!2
33 × 2!6
44 × 3!24
55 × 4!120
66 × 5!720
77 × 6!5,040
88 × 7!40,320
99 × 8!362,880
1010 × 9!3,628,800
1111 × 10!39,916,800
1212 × 11!479,001,600
1313 × 12!6,227,020,800
1414 × 13!87,178,291,200
1515 × 14!1,307,674,368,000
1616 × 15!20,922,789,888,000
1717 × 16!355,687,428,096,000
1818 × 17!6,402,373,705,728,000
1919 × 18!121,645,100,408,832,000
2020 × 19!2,432,902,008,176,640,000

20 factorial is the largest factorial that fits in a signed 64-bit integer, which is why programs that use ordinary integers go wrong from 21! onward. The calculator above has no such limit.

How to use the factorial calculator

  1. Choose a mode: Factorial n!, Divide n! by m!, or Inverse (find n).
  2. In Factorial mode, enter n as a whole number from 0 to 10,000. A decimal between 0 and 170 also works (see the gamma section). Tick the double factorial box if you want n!! instead.
  3. Press Calculate. You get the full factorial value (every digit, not a rounded one), scientific notation (also called E notation, for example 8.07e+67), the number of digits, the trailing zeros, the prime factors of n! and the multiplication steps.
  4. For long results the box shows the first and last digits. Use Show all digits to see every digit and Copy result to copy it.
  5. The example buttons load 7, 13, 20, 52, 100 and 0.5, and the page address updates so you can share a link to the exact result.

Nothing you enter is saved or sent anywhere. Input that cannot be used, such as a negative number or an n above 10,000, gets a plain message instead of a result.

Why is 0! = 1?

Why is 0 factorial 1? 0 factorial is 1 by definition, but the definition is not arbitrary. Three ideas point to the same answer:

  1. Empty product. 0! is the product of no numbers at all, and an empty product is 1, in the same way an empty sum is 0.
  2. The recursion has to keep working. n! = n × (n − 1)! gives 1! = 1 × 0!. Since 1! = 1, 0! must be 1.
  3. Counting. There is exactly one way to arrange zero items: do nothing. So the factorial of 0 is 1, not 0.

If zero factorial were 0, the recursion would turn every other factorial into 0 as well.

Large factorials and 52 factorial

Factorials outgrow almost everything. 25! has 26 digits, 100! has 158 digits, 170! has 307, 1000! has 2,568 and 10,000! has 35,660. Spreadsheets and most calculators switch to rounded decimals at 170! (about 7.26 × 10^306) and give an error or infinity for 171!. This calculator uses exact whole numbers, so 100 factorial, 1000 factorial and 10,000 factorial appear digit for digit, together with their digit counts. The factorial of 100, for instance, has 158 digits.

To count the zeros at the end of n!, count the factors of 5, because there are always plenty of 2s to pair with them: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … For 100!, that is 20 + 4 = 24 trailing zeros. The calculator shows this count for any n.

For a quick estimate without a computer, Stirling’s approximation says n! ≈ √(2πn) × (n/e)^n. For n = 100 it gives about 9.325 × 10^157, close to the exact 9.333 × 10^157 (about 0.08% too low).

52 factorial

52 factorial is the number of different orders of a shuffled deck of cards. The 52 factorial exact value is:

52! = 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000

How big is 52 factorial? About 8.07 × 10^67, a number with 68 digits and 12 trailing zeros. If you listed one new order every second, 52 factorial seconds would be about 2.56 × 10^60 years (using a 365.25-day year), far longer than the age of the universe. So a well-shuffled deck is almost certainly in an order that has never existed before.

Line chart of digits in n factorial for n = 0 to 100, marking 20! with 19 digits, 52! with 68 and 100! with 158
Factorials grow fast: 20! has 19 digits, 52! has 68 digits and 100! has 158 digits.

Divide one factorial by another

A factorial division such as 12! ÷ 10! is quick because most of the factors cancel:

12! ÷ 10! = (12 × 11 × 10!) ÷ 10! = 12 × 11 = 132

In general, when n is larger than m, n! ÷ m! = n × (n − 1) × … × (m + 1). In the same way 9! ÷ 6! = 9 × 8 × 7 = 504. Switch the calculator to Divide mode, enter n and m, and it shows the cancelled product and the exact answer, even for values like 10,000! ÷ 9,990!. When n is smaller than m the answer is a fraction: 7! ÷ 10! = 1 ÷ (10 × 9 × 8) = 1/720.

Simplify factorial expressions

Factorial expressions simplify by cancelling, just like a factorial division. The factorial (n + 1)! is (n + 1) × n!, so (n + 1)! ÷ n! simplifies to n + 1, and (n + 2)! ÷ n! simplifies to (n + 2)(n + 1). With numbers: 7! ÷ 6! = 7 and 8! ÷ 6! = 8 × 7 = 56. Do the algebra by hand with the rule n! = n × (n − 1)!, then use Divide mode to check any numeric case. The calculator works with numbers, not with letters, so it will not simplify an expression such as (n + 1)! for you.

Inverse factorial: find n from n!

An inverse factorial answers the question “which n has n! equal to my number?” For 5,040 the answer is 7, because 7! = 5,040. Inverse mode multiplies 1 × 2 × 3 × … until it reaches or passes your number. If it lands exactly, it reports N = k!. If not, it names the two factorials your number lies between and which one is closer: 3,628,800 is exactly 10!, while 3,628,801 lies between 10! and 11!, and 5,000 lies between 6! (720) and 7! (5,040) and is nearer to 7!. Only the number 1 has two answers, since 0! and 1! both equal 1. Most numbers are not factorials, so “between” is the usual answer.

Double factorial

A double factorial, written n!!, multiplies every second number down to 1 or 2: n × (n − 2) × (n − 4) × … For example, 7!! = 7 × 5 × 3 × 1 = 105 and 8!! = 8 × 6 × 4 × 2 = 384. By convention 0!! = 1. Do not confuse n!! with (n!)!, which is the factorial of a factorial. To get a double factorial from the calculator, tick the double factorial box in Factorial mode and enter a whole number from 0 to 10,000.

Factorial of a fraction, decimal or negative number

The product definition needs a whole number, but the gamma function extends it: x! = Γ(x + 1). With it, the factorial of a fraction works too. For example, 0.5 factorial, written 0.5! (the same as 1/2 factorial), equals √π ÷ 2 ≈ 0.886227, 1.5! ≈ 1.32934 and 2.5! ≈ 3.32335, and the recursion still holds: 2.5! = 2.5 × 1.5!. Enter a decimal from 0 to 170 and the calculator uses this route and tells you so.

A negative factorial is a different story. For a negative whole number it is undefined, because the recursion would need 1 = 0 × (−1)!, and no number satisfies that. This calculator gives no value for the factorial of a negative number.

Counting arrangements with factorials

Most factorial word problems ask how many ways things can be arranged. If every item is different, the answer is n!. The six different letters of the word “planet” can be arranged in 6! = 720 ways. If some items repeat, divide by the factorial of each repeat count. The word “balloon” has 7 letters with l twice and o twice, so the number of different arrangements is 7! ÷ (2! × 2!) = 5,040 ÷ 4 = 1,260.

When the order does not matter, you choose items instead of arranging them, and factorials give that count too: the number of ways to choose 2 items from 5 is 5! ÷ (2! × 3!) = 120 ÷ 12 = 10. These counts are the starting point for permutations and combinations, and they appear in binomial coefficients as well.

Factorial in Excel, TI-84, Python and R

Each row below reproduces a result from this page, so you can confirm it with Excel, Python or R.

Factorial formulas in Excel, Python and R
TaskExcelPythonR
10!=FACT(10)math.factorial(10)factorial(10)
7!!=FACTDOUBLE(7)math.prod(range(7, 0, -2))prod(seq(7, 1, by = -2))
2.5!=GAMMA(3.5)math.gamma(3.5)gamma(3.5)

For an Excel factorial use FACT. For a factorial in Python use math.factorial, the standard Python factorial function, and for a factorial in R call factorial(). Excel’s FACT works up to 170 and returns an error after that, R’s factorial() returns Inf from 171, and Python’s math.factorial gives exact answers of any size. On a TI-84, type the number, press MATH, move to PRB, choose 4:! and press ENTER. Most scientific calculators have a factorial button, usually labeled x!, so factorial on calculator is one key press after the number. On a Casio, look for the x! key; on many models it is printed above another key, so press SHIFT or the second-function key first.

Where factorials are used

Factorials count orderings, so they show up wherever order or selection matters. The hypergeometric calculator uses them to count card hands and lottery draws, and the formula behind the Poisson distribution calculator divides by k!, for instance 8! in its worked example. Card-game odds rest on the same counting idea, while everyday chance questions that do not need factorials have their own calculator. For more tools in this area see the probability and distribution calculators.

Common mistakes with factorials

  • Reading 3 + 2! as 5!. The ! belongs only to the 2.
  • Thinking 0! = 0. It is 1.
  • Treating (a + b)! as a! + b!. For example (2 + 3)! = 120, but 2! + 3! = 8, and 2! × 3! = 12 is not 5! either.
  • Adding or subtracting factorials as if the result were a factorial. 5! + 3! = 120 + 6 = 126, which is not 8!.
  • Mixing up n! with n × n. 5! = 120, while 5 × 5 = 25.
  • Trusting a spreadsheet or phone calculator past 170!, where results are rounded or fail.
  • Typing 1e5 in this calculator. Write the number in full, for example 100000 (and remember n is limited to 10,000).

Factorial calculator FAQs

What is a factorial?

A factorial is the product of a whole number and all the positive whole numbers below it, written n!. For example, 4! = 4 × 3 × 2 × 1 = 24.

How do you calculate a factorial?

Multiply the number by each whole number below it until you reach 1, or multiply it by the factorial just below it: n! = n × (n − 1)!. For example, 9! = 9 × 8! = 9 × 40,320 = 362,880.

What is 7 factorial?

7 factorial is 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040.

What is the factorial of 1, 2, 3, 4 and 5?

1! = 1, 2! = 2, 3! = 6, 4! = 24 and 5! = 120.

What is 10 factorial?

10 factorial is 3,628,800.

What is 20 factorial?

20 factorial is 2,432,902,008,176,640,000, the largest factorial that fits in a signed 64-bit integer.

What is 0 factorial, and why is it 1?

0! = 1. It is the empty product, it keeps n! = n × (n − 1)! working for n = 1, and there is exactly one way to arrange nothing.

What is 1000 factorial?

1000! has 2,568 digits, begins 4.0238726 × 10^2567 and ends with 249 zeros. Enter 1000 in the calculator to see every digit.

What is 52 factorial?

52! is about 8.07 × 10^67, a number with 68 digits. It is the number of ways to order a deck of 52 cards.

What is the factorial formula?

n! = n × (n − 1) × (n − 2) × … × 2 × 1, with 0! = 1. It can also be written as the recursion n! = n × (n − 1)!.

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

Not of a negative whole number, which is undefined. A decimal such as 0.5 has a factorial through the gamma function: 0.5! ≈ 0.886227.

What is a double factorial?

A double factorial n!! multiplies every second number down from n. For example, 7!! = 7 × 5 × 3 × 1 = 105.

How do you do a factorial on a TI-84 or a calculator?

On a TI-84, type the number, press MATH, move to PRB and choose 4:!. Most scientific calculators have an x! key.

How do you divide factorials?

Cancel the common part. For example, 12! ÷ 10! = 12 × 11 = 132. Use Divide mode for larger values.

What is an inverse factorial?

It is the n whose factorial equals a given number. For 5,040 it is 7, because 7! = 5,040.

What is E notation in a factorial result?

E notation is scientific notation written on one line: 8.07e+67 means 8.07 × 10^67. The calculator shows it next to the full value so you can read huge factorials at a glance.

Can you add or subtract factorials?

Yes, but the result is just a number, not a factorial. For example 5! + 3! = 120 + 6 = 126, and 5! − 3! = 114.

Is this factorial calculator accurate?

Yes. It uses exact whole-number arithmetic for n up to 10,000, with no rounding, and it was checked against Python, R and Excel formulas.

Easy Stat Calc · Results checked against Python, R and Excel formulas · Last updated December 2, 2026 · Methodology