Math Solver Free

Factorial Calculator

Compute n! with full step expansion — exact even for huge numbers.

Updated 3 December 2026

5! = 120

5! = 5 × 4 × 3 × 2 × 1 = 120

5! has 3 digits.

Definition: n! = n × (n−1) × … × 2 × 1, with 0! = 1 by definition.

Uses: counting permutations and combinations in probability and statistics.

Where Factorials Come From

A factorial answers an everyday counting question. Ask “in how many orders can 5 books sit on a shelf?” — the first slot has 5 choices, the next 4, then 3, 2, 1, and multiplying the choices gives 5! = 120. That is all a factorial is: a compact way to write the product of the counting choices. Factorials count permutations, and they explode fast: 10! is already 3.6 million, and 20! exceeds 2 quintillion. Type any whole number from 0 to 1000 above and this calculator returns the exact value, however many digits it has.

The Definition, Symbol by Symbol

The definition is n! = n × (n−1) × (n−2) × … × 2 × 1. Here n is a non-negative whole number — the starting point of the product and the count of objects being arranged. The exclamation mark ! is the factorial operator itself: it is not punctuation and not emphasis, it is an instruction to multiply every whole number from n down to 1. Each number in the chain is called a factor of the product. Because n! = n × (n−1)!, every factorial is built from the one before it — exactly the loop this tool runs, using exact BigInt arithmetic so no digit is ever rounded away.

The Two Facts That Confuse Everyone

  • 0! = 1 by definition — an empty product equals 1, which keeps combination formulas working.
  • Factorials only apply to whole numbers. For decimals, mathematicians extend the idea with the Gamma function, where n! = Γ(n+1).

How to Use This Factorial Expression Calculator

  1. Type a whole number into the single “Enter n (0 – 1000)” box. There is no button — the result updates as you type.
  2. Read the headline result n! = …, shown in full for shorter values and truncated with its true digit count for very large ones.
  3. Check the expansion line: for n up to 12 the tool writes out the complete product (for example 5! = 5 × 4 × 3 × 2 × 1 = 120) so you can verify each factor.
  4. Mind the limits: negatives and values over 1000 get an explanation instead of a number, and decimals get the Gamma-function note.

Worked Example 1: Computing 7! Step by Step

  1. Start at the top: 7 × 6 = 42.
  2. Bring in the 5: 42 × 5 = 210.
  3. Bring in the 4: 210 × 4 = 840.
  4. Bring in the 3: 840 × 3 = 2,520.
  5. Finish with 2 and 1: 2,520 × 2 = 5,040, and × 1 leaves it unchanged. So 7! = 5,040.

Notice how the running total jumps: adding one more factor does not add a fixed amount, it multiplies everything so far. That is why 7! is already in the thousands while 7 + 6 + 5 + 4 + 3 + 2 + 1 is just 28. In counting terms, 5,040 is the number of ways 7 runners can cross a finish line in some order, or the number of different seven-digit strings you can make from the digits 1 to 7 with no repeats.

Worked Example 2: Choosing a Committee of 3 From 10

  1. Use the combination formula: C(10, 3) = 10! ÷ (3! × 7!).
  2. Cancel before you multiply: 10! contains 7! as its tail (10 × 9 × 8 × 7!), so the 7! cancels top and bottom, leaving (10 × 9 × 8) ÷ 3!.
  3. Compute the pieces: 10 × 9 × 8 = 720, and 3! = 3 × 2 × 1 = 6.
  4. Divide: 720 ÷ 6 = 120 different committees.

The cancellation step is the professional shortcut: nobody evaluates 10! = 3,628,800 and 7! = 5,040 in full just to divide them. It also explains the division in the formula — the 720 ordered selections (permutations) count each committee 3! = 6 times, once for each internal ordering, and dividing by 6 removes exactly that overcount. Order stopped mattering, so each group is counted once.

Worked Example 3: Evaluating a Factorial Expression — 5! ÷ 3!

Real problems rarely ask for a bare factorial; they ask for an expression built from factorials, like 5! ÷ 3!. The amateur evaluates both numbers in full and then divides. The professional cancels first.

  1. Expand the bigger factorial down to the smaller: 5! = 5 × 4 × 3!, so the expression becomes (5 × 4 × 3!) ÷ 3!.
  2. Cancel: the 3! on top and bottom divide away, leaving 5 × 4.
  3. Answer: 5 × 4 = 20. Brute force agrees: 120 ÷ 6 = 20.

The same trick runs in reverse for products: 7! ÷ (5! × 2!) = (7 × 6) ÷ 2 = 21, because 7! = 7 × 6 × 5! and the 5! cancels. Cancellation is why the combinations formula stays painless even for large numbers — you never actually compute the giant factorials.

Factorials in Probability

Combinations (nCr) and permutations (nPr) are built from factorials — lottery odds, poker hands, and committee selections all reduce to factorial division. Try the probability calculator to put them to work.

When Factorials Turn Up in Real Life

A shuffled deck of cards has 52! ≈ 8.07 × 10^67 possible orders — so many that every proper shuffle in history has almost certainly produced an arrangement never seen before. Lottery odds are factorial arithmetic: a 6-from-49 draw has C(49, 6) = 13,983,816 combinations. Computer scientists meet factorials when counting the possible orderings an algorithm might have to search, which is why brute-force methods die so quickly as n grows. Even the denominators in the Taylor series for e^x and sin x are factorials quietly doing the work.

Common Mistakes

  • Adding the numbers instead of multiplying. 5! is 120, not 5 + 4 + 3 + 2 + 1 = 15. The exclamation mark means a product chain — every term multiplies.
  • Writing 0! = 0. It is 1. Setting it to 0 silently breaks every combination formula that uses it, turning “choose none” into “impossible”.
  • Using a permutation when order does not matter. Counting a committee with n! style reasoning overcounts by the internal orderings — divide by r! for combinations, or your “120 committees” becomes 720.

Frequently Asked Questions

What is a factorial?

The factorial of n (written n!) is the product of all positive integers from 1 up to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count arrangements — n distinct objects can be lined up in exactly n! orders. They also obey a neat recursion, n! = n × (n−1)!, which is how this calculator builds each answer one multiplication at a time.

What is 0 factorial (0!)?

0! = 1 by definition. It sounds odd, but it is forced by consistency: there is exactly one way to arrange zero objects (do nothing), and the recursion n! = n × (n−1)! only works at n = 1 if 0! = 1. It also keeps combination formulas valid — choosing 0 items from n gives C(n, 0) = 1, not 0.

How do you calculate large factorials like 100!?

By exact integer arithmetic, one multiplication at a time. 100! has 158 digits, far beyond the roughly 16 significant digits an ordinary calculator keeps, and standard floating-point arithmetic overflows completely at 171!. This tool uses BigInt arithmetic instead, so every digit is exact for any n up to 1000 — and 1000! itself has 2,568 digits.

What is the difference between permutations and combinations?

Order. A permutation counts arrangements where order matters — podium finishes, passwords, race results — and P(n, r) = n! ÷ (n−r)!. A combination counts selections where order is irrelevant — committees, lottery tickets, card hands — and C(n, r) = n! ÷ (r!(n−r)!). From 10 people, there are 720 ordered podiums of 3 but only 120 unordered groups of 3.

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

Not with the ordinary definition — factorials exist only for non-negative whole numbers, and negative integers have no factorial at all. For decimals, mathematicians extend the idea with the Gamma function, using n! = Γ(n+1): it gives, for example, (1/2)! = √π ÷ 2 ≈ 0.8862. Enter a decimal above and the tool explains this instead of forcing a wrong answer.

Is this factorial calculator free?

Yes — every tool on Math Solver Free is free with no sign-up, and all calculations run in your browser. Type any whole number from 0 to 1000 and the exact factorial appears instantly, with the full multiplication expansion for smaller values and a digit count for the giants.

How do you evaluate a factorial expression like 5!/3!?

Cancel before you multiply. Expand the larger factorial down to the smaller one: 5! = 5 × 4 × 3!, so 5!/3! = 5 × 4 = 20 — the 3! divides away. The same method handles products, such as 7!/(5! × 2!) = (7 × 6)/2 = 21. This factorial expression calculator shows the full expansion for any single n!, and cancellation turns expressions built from factorials into short multiplications.

Related Tools & Guides

About the Math Solver Team

The Math Solver Team builds and maintains the calculators and step-by-step solvers on this site. Every tool is checked against worked textbook examples before it is published, and the method behind each solver is written out in full — in the worked examples on the page and in our guides — so you can see exactly how an answer is reached, not just the answer itself.

How we build and test our tools·More about the team