TR

Home / Guides / How to Calculate Factorials, Permutations and Combinations

How to Calculate Factorials, Permutations and Combinations

Updated: October 31, 2026 · AracMerkezi

▶ Open Factorial, Permutation and Combination Calculator

Factorials, permutations and combinations are the three building blocks of counting. Questions such as "How many different orders are there?" or "How many different groups can be chosen?" are answered with these three ideas. In this guide you will find the formulas, worked step-by-step examples and the points to watch for with large numbers. To try your own numbers, use the Factorial, Permutation and Combination Calculator.

What is a factorial?

For a positive integer n, n! (n factorial) is the product of all integers from 1 to n:

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

For example, 5! = 5 × 4 × 3 × 2 × 1 = 120 and 10! = 3,628,800. A factorial tells you how many different orders n distinct items can be arranged in. Five people can line up in 120 different ways.

### Why is 0! equal to 1?

0! is defined as 1 for three reasons: there is exactly one way to arrange nothing (doing nothing), the relation n! = n × (n−1)! stays consistent for 1! = 1 × 0! only if 0! = 1, and C(n,n) = n! ÷ (n! × 0!) = 1 comes out right only with this definition.

### How fast does the factorial grow?

nn!Number of digits
51203
103,628,8007
202,432,902,008,176,640,00019
52about 8.0658 × 10^6768
100about 9.3326 × 10^157158

20! is about 2.43 quintillion and is the last factorial that fits in a 64-bit signed integer; 21! exceeds this limit. The 2^53 limit up to which JavaScript can represent integers safely is passed between 18! and 19!. That is why large factorials need arbitrary-length integer types such as BigInt.

Permutation: when order matters

The number of ways to choose r items out of n, where order matters and without repetition, is:

P(n, r) = n! ÷ (n − r)!

The logic behind the formula is this: n options for the first pick, n−1 for the second, n−2 for the third, and so on for r steps. The product n × (n−1) × … × (n−r+1) is the same as n! ÷ (n−r)!.

Example: A club of 10 people will elect a president, a secretary and a treasurer. The roles are different, so order matters.

P(10, 3) = 10 × 9 × 8 = 720

When r = n, P(n, n) = n!: five people taking five seats can do so in P(5,5) = 120 ways.

Combination: when order does not matter

If we make the same selection without regard to order, each group made of the same people has been counted r! times in different orders. To correct this, we divide the permutation count by r!:

C(n, r) = n! ÷ (r! × (n − r)!) = P(n, r) ÷ r!

Example: A committee of 3 will be chosen from the same 10 people, with no distinction of roles.

C(10, 3) = 10! ÷ (3! × 7!) = (10 × 9 × 8) ÷ (3 × 2 × 1) = 720 ÷ 6 = 120

The permutation count is 720 and the combination count is 120; the ratio between them is exactly 3! = 6.

### Handy properties of combinations

Step-by-step method

  1. Decide whether order matters. If it does, use a permutation; if not, a combination.
  2. Write down n and r. n is the total number of items and r is the number chosen.
  3. Check for repetition. If the same item can be chosen more than once, use the formulas for repetition.
  4. Apply the formula. For large n, use the simplified product instead of writing out every factorial: C(52, 5) = (52 × 51 × 50 × 49 × 48) ÷ (5 × 4 × 3 × 2 × 1).
  5. Sanity-check the result. A combination can never be larger than the permutation.

Example (a hand of cards): Drawing 5 cards from a 52-card deck, where order does not matter, gives C(52, 5) = 2,598,960 different hands.

Example (a large combination): The number of ways to choose 6 numbers out of 49 is C(49, 6) = 13,983,816. In a draw where every group is equally likely, the probability of one specific set of 6 is 1 ÷ 13,983,816; for more on probability, see our guide to dice and coin-flip probability.

Cases with repetition

CaseFormulaExample
n options for each of r positionsn^r4-digit PIN: 10^4 = 10,000
Unordered selection, repeats allowedC(n + r − 1, r)3 scoops from 5 ice cream flavors: C(7, 3) = 35
Arrangements with identical itemsn! ÷ (n₁! × n₂! × …)MISSISSIPPI: 11! ÷ (1! × 4! × 4! × 2!) = 34,650

Identical-items example: The word ANKARA has 6 letters, and A appears three times. The number of distinct arrangements is 6! ÷ 3! = 720 ÷ 6 = 120.

Common mistakes

Checking with the calculator

When you pick the calculation type and enter n and r in our tool, you see the expansion of the operation, the permutation-versus-combination comparison and, where relevant, the digit count and the exact value. The upper limit for n and r is 1000. When you work with prime factors, the prime factorization tool is also useful.

Note on currency of information

The formulas in this guide are universal mathematics and do not change from year to year. This guide was prepared on October 31, 2026.

Summary

A factorial counts the arrangements of n items, a permutation P(n,r) = n! ÷ (n−r)! counts ordered selections, and a combination C(n,r) = n! ÷ (r! × (n−r)!) counts unordered selections. In the examples we found P(10,3) = 720, C(10,3) = 120 and C(52,5) = 2,598,960. First decide whether order matters, then choose the right formula.

Frequently asked questions

How is a factorial calculated, and why is 0! equal to 1?

n! is the product of the integers from 1 to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. 0! is defined as 1 because there is exactly one way to arrange zero items (do nothing), and this definition keeps the counting formulas consistent.

What is the difference between a permutation and a combination?

In a permutation the order of the chosen items matters; in a combination it does not. Since P(n,r) = n! ÷ (n−r)! and C(n,r) = n! ÷ (r! × (n−r)!), we have P = C × r!. For example, P(10,3) = 720 and C(10,3) = 120.

Why do factorials above 20 cause errors on a regular calculator?

21! exceeds the 64-bit signed integer limit, and 19! is already above the 2^53 limit that JavaScript can represent safely. This tool uses BigInt, so it can compute huge results such as 1000! as exact values.

Tools mentioned in this guide

More guides

This article is for general information only and is not legal, financial or medical advice. We are not an official institution.