๐Ÿ‡บ๐Ÿ‡ธ USC
Math & Conversion
โ—

Factorial Calculator

Compute n! exactly, with the full expansion and step-by-step product

โ— Enter a number

Try 0, 5, 10 or 20. Uses exact arithmetic (BigInt) so even huge factorials are precise.

๐ŸŸฐ Result

5!
120
Number of digits
3
Input
5

โœ–๏ธ Expanded multiplication

5! = 5 ร— 4 ร— 3 ร— 2 ร— 1 = 120

๐Ÿ“‹ Step by step

StepMultiply byRunning product
1ร— 11
2ร— 22
3ร— 36
4ร— 424
5ร— 5120

Each step multiplies the running total by the next integer, finishing at 5!.

Factorials are exact integers, computed here with arbitrary-precision BigInt arithmetic. Very large results are previewed in scientific notation, with the full exact value available above.

โœ…

Last updated June 2026

Method: The factorial is computed by the standard definition n! = n ร— (n โˆ’ 1) ร— โ€ฆ ร— 2 ร— 1, with 0! = 1. Arithmetic uses arbitrary-precision BigInt, so every digit of the result is exact.

Included: The exact value of n!, the number of digits, the expanded multiplication, and a step-by-step running product for small n. Huge results show a scientific-notation preview plus the full exact digits on demand.

Not included: The gamma function for non-integer inputs, negative-number factorials, double factorials (n!!), and modular factorials. Inputs must be non-negative whole numbers.

Factorial calculator: everything you need to know

The factorial of a number tells you how many ways you can arrange a set of items in order, and it shows up almost everywhere you count possibilities - shuffling a deck of cards, ranking finishers in a race, or working out the odds in a lottery. Written with an exclamation point, 5! (read "five factorial") equals 5 ร— 4 ร— 3 ร— 2 ร— 1 = 120. This factorial calculator computes n! for any non-negative whole number, shows the expanded multiplication so you can see exactly where the answer comes from, and uses exact arithmetic so even enormous factorials stay precise to the last digit.

What a factorial actually means

Imagine you have three different books and want to line them up on a shelf. The first slot can hold any of the 3 books, the second slot any of the remaining 2, and the last slot the final 1 book. Multiply those choices together - 3 ร— 2 ร— 1 - and you get 6 possible orderings. That product is exactly 3!. In general, n! counts the number of distinct ways to arrange n different items in a row. This is why factorials are the backbone of combinatorics: permutations, combinations, and probability formulas are all built on top of them.

The factorial formula and definition

The factorial of a non-negative integer n is the product of every whole number from 1 to n:

n! = n × (n − 1) × (n − 2) × … × 2 × 1

There is also a neat recursive definition that says each factorial is built from the one before it:

n! = n × (n − 1)!   with   0! = 1

Both definitions produce identical results. The recursive form is handy in programming and proofs, while the spelled-out product is easier to picture. The crucial base case is 0! = 1: there is exactly one way to arrange nothing (do nothing), and that value keeps every formula built on factorials consistent.

Worked example: 5!

Let's compute 5! by hand, multiplying one step at a time:

  • Start at 1.
  • 1 ร— 2 = 2
  • 2 ร— 3 = 6
  • 6 ร— 4 = 24
  • 24 ร— 5 = 120

So 5! = 120. That means five different items can be ordered in 120 distinct ways - the same number of ways five guests can be seated in a row, or five runners can finish a race.

How to use this factorial calculator

You only need one number to get a complete answer. Here is the workflow:

  1. Enter n: type a non-negative whole number (for example 0, 7, 20, or 100) into the input box.
  2. Read the result: the large blue number at the top is n!. For small inputs it is shown in full with thousands separators; for very large inputs it shows a tidy scientific-notation preview.
  3. See the expansion: the "Expanded multiplication" card spells out n ร— (n โˆ’ 1) ร— โ€ฆ ร— 1 so you can follow the logic.
  4. Follow the steps: for small n, the step-by-step table shows the running product after each multiplication, mirroring how you would do it on paper.
  5. Expand huge results: when a factorial has hundreds of digits, open the "Show all digits" panel to reveal the exact integer.

The result updates instantly as you type - there is no "calculate" button to press. Use the quick-pick chips (0!, 5!, 10!, 20! and more) to jump to common values.

Who this calculator is for

Factorials sit at the crossroads of school math and real-world counting problems, so this tool serves a wide audience:

  • Students learning combinatorics, probability, or the binomial theorem who need to check homework.
  • Teachers who want a clean expansion to project or share when introducing permutations.
  • Programmers verifying a factorial function or testing against an exact reference value.
  • Statisticians and data scientists computing permutations, combinations, or Poisson-style terms by hand.
  • Anyone curious about just how fast factorials explode - try 70! and watch the digit count climb past 100.

Worked example: 10! and a permutation

Computing 10! gives 3,628,800 - that is the number of ways to order ten distinct items. Now suppose you only care about arranging 3 of those 10 items in order. That is a permutation, written P(10, 3), and it equals 10! / (10 โˆ’ 3)! = 10! / 7! = 3,628,800 / 5,040 = 720. Notice how the factorial does the heavy lifting: you compute the full count and then divide away the orderings you do not care about. The same idea drives combinations, where you divide by an extra factorial to ignore order entirely.

Worked example: a huge factorial

Enter 52 and you get the number of ways to shuffle a standard deck of cards: 52! โ‰ˆ 8.07 ร— 10^67, a 68-digit number. That figure is so vast that every thoroughly shuffled deck in history has almost certainly been in an order never seen before. Push to 100! and the result has 158 digits. Ordinary calculators give up or round here, but this tool keeps every digit because it uses arbitrary-precision integers - expand the digits panel to see all 158 of them.

Factorial reference table

Here are the factorials of 0 through 20 - a handy reference for spot-checking and seeing how quickly they grow:

n n!
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

Notice that 13! already exceeds 6 billion, and by 20! the value passes 2.4 quintillion. This explosive growth is why factorials outrun exponential functions and why even modest inputs need big-integer math.

Key terms explained

  • Factorial (n!): the product of all positive integers up to n; counts orderings of n items.
  • Permutation P(n, r): the number of ordered arrangements of r items from n, equal to n! / (n โˆ’ r)!.
  • Combination C(n, r): the number of unordered selections of r from n, equal to n! / (r! ร— (n โˆ’ r)!).
  • Gamma function ฮ“: a continuous extension of the factorial where ฮ“(n + 1) = n!, defined for non-integers too.
  • Double factorial (n!!): the product of integers with the same parity as n (for example 7!! = 7 ร— 5 ร— 3 ร— 1); a different operation from the ordinary factorial.
  • Stirling's approximation: a formula, n! โ‰ˆ โˆš(2ฯ€n) (n/e)^n, that estimates large factorials without multiplying every term.

Why factorials grow so fast

Each step in a factorial multiplies by a larger number than the last, so the value compounds at an ever-increasing rate. An exponential like 2^n multiplies by the same factor (2) each step; a factorial multiplies by n, n โˆ’ 1, n โˆ’ 2 and so on. That is why n! eventually overtakes any fixed-base exponential and why the number of digits climbs steeply. Stirling's approximation captures this: it shows the digit count grows roughly in proportion to n log n, which is why 100! lands at 158 digits and 1000! at over 2,500.

Where factorials show up

Beyond textbook exercises, factorials appear constantly:

  • Card games and shuffling: 52! is the number of possible deck orders.
  • Probability and odds: permutations and combinations - both built on factorials - count favorable and total outcomes.
  • The binomial theorem: binomial coefficients "n choose r" use factorials to expand (a + b)^n.
  • Calculus and series: Taylor series for sine, cosine and e^x divide each term by a factorial.
  • Algorithms: the brute-force cost of checking every ordering (such as the traveling-salesman problem) is n!.

Tips for working with factorials

  • Cancel before you multiply: in expressions like 10! / 7!, cancel the shared terms (10! / 7! = 10 ร— 9 ร— 8 = 720) instead of computing both factorials.
  • Remember 0! = 1 and 1! = 1: these base cases trip up many beginners.
  • Use exact arithmetic: past about 21!, ordinary floating-point loses precision - this calculator's BigInt math does not.
  • Estimate with Stirling: when you only need the rough size or digit count, Stirling's approximation is faster than the full product.

How it compares to related calculators

This page answers "what is n!?" If your question is a bit different, a sister tool fits better:

  • To raise a number to a power, use the Exponent Calculator.
  • To find a square root, use the Square Root Calculator.
  • For percentages and "what is X% of Y," use the Percentage Calculator.
  • To compute the mean of a list, use the Average Calculator.
  • For trig, logs and general expressions, use the Scientific Calculator.

โš ๏ธ Common mistakes & edge cases

Thinking 0! = 0

A common slip is assuming the factorial of zero is zero. It is not - 0! = 1 by definition, because there is exactly one way to arrange nothing, and it keeps the recurrence n! = n ร— (n โˆ’ 1)! consistent.

Trying to take the factorial of a decimal or negative

The ordinary factorial is only defined for non-negative whole numbers. There is no plain factorial of 2.5 or โˆ’3; those require the gamma function instead. This calculator rejects such inputs rather than guessing.

Trusting a standard calculator for large n

Past about 21!, ordinary floating-point numbers can no longer store the result exactly and start rounding the trailing digits. If you need every digit (for example checking a programming result), use exact BigInt math like this tool does.

Confusing n! with n!! or with permutations

The double factorial n!! multiplies only the same-parity terms (7!! = 7 ร— 5 ร— 3 ร— 1), and a permutation P(n, r) arranges just r of the n items. Both are related to, but different from, the ordinary factorial.

Note: This calculator computes the standard factorial for non-negative integers only. For non-integer or negative inputs, you would need the gamma function, which is a separate operation.

❓ Frequently asked questions

What is a factorial?

The factorial of a non-negative integer n, written n!, is the product of every whole number from 1 up to n. For example, 5! = 5 ร— 4 ร— 3 ร— 2 ร— 1 = 120. It counts the number of distinct ways to arrange n different items in order, which is why factorials appear throughout combinatorics, probability and statistics.

Why is 0! equal to 1?

By definition, 0! = 1. There is exactly one way to arrange zero items (the empty arrangement), so the count is 1. It also makes formulas consistent: the recurrence n! = n ร— (n โˆ’ 1)! gives 1! = 1 ร— 0!, which only works if 0! = 1. The same value keeps the binomial-coefficient and series formulas that rely on factorials from breaking down.

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

The ordinary factorial is only defined for non-negative integers (0, 1, 2, 3, โ€ฆ). Negative numbers and fractions have no standard factorial. Mathematicians extend the idea to those values with the gamma function, where ฮ“(n + 1) = n! for whole numbers, but that is a separate function. This calculator only handles non-negative whole numbers.

How big does a factorial get?

Factorials grow faster than exponentials. 10! is already 3,628,800; 20! is about 2.4 ร— 10^18; and 100! has 158 digits. They quickly exceed what standard floating-point numbers can store exactly, which is why this calculator uses arbitrary-precision (BigInt) arithmetic to keep every digit correct.

How is the factorial calculated?

You start with 1 and multiply by each integer in turn: 1 ร— 2 ร— 3 ร— โ€ฆ ร— n. Equivalently, you can use the recursive rule n! = n ร— (n โˆ’ 1)! with the base case 0! = 1. Both give the same result; this tool multiplies iteratively to avoid deep recursion and shows the running product for small n.

What is the difference between a factorial and a permutation?

A factorial n! counts the arrangements of all n items. A permutation P(n, r) = n! / (n โˆ’ r)! counts the ordered arrangements of just r items chosen from n. So a factorial is the special case of a permutation where you arrange every item (r = n).

Why are factorials used in probability?

Many probability questions reduce to counting arrangements or selections. Factorials are the building block for permutations (ordered) and combinations (unordered), which in turn give the number of possible outcomes. For example, the number of 5-card poker hands from a 52-card deck is 52! / (5! ร— 47!) = 2,598,960.

Does this calculator give an exact answer for large n?

Yes. It computes with BigInt, so the result is the exact integer no matter how many digits it has. For very large factorials it shows a compact scientific-notation preview for readability, but you can expand the panel to see every digit of the exact value.

What is the largest number I can enter?

For a smooth experience in the browser, the calculator handles n up to 100,000. The exact result for numbers that large has hundreds of thousands of digits, so it is shown in scientific notation with the full digit string available on demand. Beyond that limit, computing and rendering the value would be too slow.

What does the exclamation point mean in math?

In mathematics, the exclamation point after a number means 'factorial.' So '5!' is read as 'five factorial' and equals 120. It is not an expression of emphasis - it is a standard operator that tells you to multiply the number by every positive integer below it.

๐Ÿ’ก Good to know

The exclamation point is the factorial operator

In math, "5!" does not mean shouting - it is read "five factorial" and equals 120. The symbol was introduced in the early 1800s and has been the standard notation ever since.

Factorials beat exponentials

For large enough n, n! grows faster than any fixed-base exponential like 2^n or 10^n. That is why a brute-force algorithm that checks every ordering becomes impossible well before n reaches 20.

Exact to the last digit

Because this calculator uses arbitrary-precision integers, the result is exact no matter how many digits it has - 100! is shown with all 158 digits intact, not rounded.

Related Calculators