Factorial Calculator

Factorials count arrangements. Once you see them that way, permutations and combinations stop being formulas to memorise.

Last updated: August 2026 · Written and verified by Akash Pandey

Calculate a factorial, nPr or nCr

Factorial

—

This runs the same calculation engine as the main scientific calculator, entirely in your browser. Nothing you type is sent anywhere.

What a factorial counts

n! is the product of every whole number from 1 up to n. But the reason it matters is what it counts: the number of ways to arrange n distinct objects in order. Three books can sit on a shelf in 3! = 6 orders. Ten books can sit in 10! = 3,628,800.

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

  • Defined for non-negative whole numbers only.
  • 0! = 1 by definition - there is exactly one way to arrange nothing.
  • The recursive form n! = n × (n−1)! is often more useful than the expanded one.

The 0! = 1 convention is not a fudge. Every formula that uses factorials - the binomial theorem, the Taylor series, nCr - only stays consistent if 0! is 1. And the counting argument agrees: there is exactly one arrangement of an empty set, namely the empty arrangement.

Permutations and combinations

Both answer "how many ways can I pick r things from n?". The difference is whether order counts.

nPr = n! ÷ (n − r)! nCr = n! ÷ (r! × (n − r)!)

  • nPr - permutations. Order matters: first, second and third place in a race.
  • nCr - combinations. Order does not matter: which three people are on a committee.
  • nCr is just nPr divided by r!, because each unordered selection was counted r! times over.

That last line is the whole relationship. If you can count ordered selections, you can count unordered ones by dividing out the orderings you double-counted.

Worked examples

  1. Evaluate 5!

    5!

    1. Multiply down from 5: 5 × 4 = 20.
    2. 20 × 3 = 60.
    3. 60 × 2 = 120.
    4. Multiplying by 1 changes nothing, so the answer is 120 - the number of ways to order five distinct items.

    = 120

  2. How many ways can 3 of 10 runners take the medals?

    nPr(10, 3)

    1. Order matters here - gold, silver and bronze are different outcomes.
    2. There are 10 choices for gold, then 9 remaining for silver, then 8 for bronze.
    3. 10 × 9 × 8 = 720.
    4. By formula: 10! ÷ 7! = 3,628,800 ÷ 5,040 = 720. ✓

    = 720

  3. How many 5-card hands are there in a 52-card deck?

    nCr(52, 5)

    1. Order does not matter - a hand is the same hand however it was dealt.
    2. Ordered selections first: 52 × 51 × 50 × 49 × 48 = 311,875,200.
    3. Each hand was counted 5! = 120 times, once per dealing order.
    4. 311,875,200 ÷ 120 = 2,598,960.

    = 2,598,960

  4. How many ways can a committee of 3 be picked from 10 people?

    nCr(10, 3)

    1. Order does not matter on a committee.
    2. Start from the ordered count: nPr(10,3) = 720.
    3. Divide by 3! = 6 to remove the duplicate orderings.
    4. 720 ÷ 6 = 120.

    = 120

Factorial table, 0! to 20!

nn!
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
Factorials grow faster than any exponential. 20! already exceeds two quintillion.

Negative and non-integer factorials

The counting definition runs out below zero: there is no way to arrange −3 objects. (−3)! is rejected as an invalid expression.

Decimals are a more interesting case. The counting argument does not cover them either - half an object cannot be arranged - but mathematics extends the factorial to non-integers through the gamma function, where Γ(n+1) = n!. This calculator inherits that extension from its underlying library, so 3.5! returns roughly 11.6317 rather than an error, and 0.5! gives √π/2 ≈ 0.8862.

Frequently Asked Questions

Why is 0! equal to 1?

There is exactly one way to arrange an empty set - the empty arrangement. The convention is also forced by the formulas: nCr(n, n) must be 1, and that only works if 0! is 1.

What is the difference between nPr and nCr?

nPr counts selections where order matters, nCr where it does not. Podium places use nPr; a committee or a card hand uses nCr. They are related by nCr = nPr ÷ r!.

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

Negative numbers, no - (−3)! is rejected. Decimals, yes: the calculator uses the gamma function extension, so 3.5! returns about 11.6317. That is a real mathematical value, but it answers a question about the gamma function rather than about counting arrangements.

How large a factorial can this calculator handle?

Up to 170!, beyond which the result exceeds the largest representable number and overflows. Exact digit-for-digit display stops much earlier, at 2⁵³ − 1, after which results are shown in scientific notation.

How do I type a factorial on the main calculator?

Enter the number, then press the n! key. It is a postfix operator, so 5! reads left to right just as it is written.

What is 52 choose 5?

2,598,960 - the number of distinct 5-card poker hands from a standard deck. It is 52! ÷ (5! × 47!).

How do factorials relate to probability?

Factorials count arrangements. The probability of a specific sequence of n distinct items is 1/n!, because there are n! equally likely orderings. This is why the birthday problem and card-shuffling questions involve factorials.

What is Stirling's approximation?

A formula that estimates n! for large n: n! ≈ √(2πn) × (n/e)ⁿ. It becomes remarkably accurate above about n = 10 and is used throughout physics and combinatorics when the exact value is too large to compute.