OhMyApps
Back to Blog
Tools Math Calculator Statistics Tutorial

Factorial Calculator: Compute Factorials, Permutations, and Combinations

6 min read By OhMyApps

Factorials, permutations, and combinations are the building blocks of counting problems in mathematics, statistics, and computer science. Whether you are solving a probability question, calculating the number of possible passwords, or working through a combinatorics homework set, doing these by hand gets tedious fast. Our calculator handles all three operations with instant results.

What Is a Factorial?

A factorial of a non-negative integer n, written as n!, is the product of all positive integers from 1 to n:

  • 0! = 1 (by definition)
  • 1! = 1
  • 5! = 5 x 4 x 3 x 2 x 1 = 120
  • 10! = 3,628,800
  • 20! = 2,432,902,008,176,640,000

Factorials grow extremely fast. By 20!, you are already in the quintillions. By 100!, the number has 158 digits.

Factorial Reference Table

nn!
01
11
22
36
424
5120
6720
75,040
840,320
9362,880
103,628,800
12479,001,600
151,307,674,368,000
202,432,902,008,176,640,000

Permutations: P(n, r)

A permutation counts the number of ways to arrange r items chosen from a set of n items, where order matters.

Formula: P(n, r) = n! / (n - r)!

Examples

  • P(5, 3) = 5! / 2! = 120 / 2 = 60 — there are 60 ways to arrange 3 items from a set of 5
  • P(10, 2) = 10! / 8! = 10 x 9 = 90 — there are 90 ordered pairs from 10 items
  • P(n, n) = n! — arranging all items is just the full factorial

When to Use Permutations

Use permutations when the order of selection matters:

  • Ranking contestants (1st, 2nd, 3rd place from 10 contestants)
  • PIN codes (1234 is different from 4321)
  • Seating arrangements (who sits where)
  • Task scheduling (which job runs first, second, third)

Combinations: C(n, r)

A combination counts the number of ways to choose r items from a set of n items, where order does not matter.

Formula: C(n, r) = n! / (r! x (n - r)!)

Examples

  • C(5, 3) = 5! / (3! x 2!) = 120 / 12 = 10 — there are 10 ways to choose 3 items from 5
  • C(52, 5) = 2,598,960 — the number of possible 5-card poker hands
  • C(49, 6) = 13,983,816 — the number of possible lottery combinations (6 from 49)

When to Use Combinations

Use combinations when the order of selection does not matter:

  • Lottery draws (the numbers 3, 17, 22 are the same regardless of draw order)
  • Committee selection (choosing 4 members from 12 candidates)
  • Subset selection (which 3 toppings on a pizza from 10 options)
  • Sampling (choosing test cases from a population)

How to Use Our Factorial Calculator

  1. Choose the operation — factorial (n!), permutation P(n, r), or combination C(n, r)
  2. Enter the value of n — the total number of items
  3. Enter the value of r (for permutations and combinations) — the number of items to choose or arrange
  4. Read the result instantly
  5. Copy the output for use in your work

Common Use Cases

ScenarioOperationExample
How many ways to arrange a bookshelf?n!8 books: 8! = 40,320
How many 4-digit PINs from digits 0-9?P(10, 4)5,040 (no repeats)
Poker hand probabilitiesC(52, 5)2,598,960 hands
Lottery odds (6 from 49)C(49, 6)1 in 13,983,816
Team selection (5 from 20)C(20, 5)15,504 teams
Race finishing order (top 3 of 12)P(12, 3)1,320 orderings
Password arrangements (8 chars)8!40,320 arrangements

Tips

  • Remember the key distinction: permutations care about order, combinations do not. “Does ABC differ from CBA?” If yes, use permutations. If no, use combinations.
  • C(n, r) is always less than or equal to P(n, r) because combinations collapse all orderings of the same set into one group.
  • C(n, r) = C(n, n-r). Choosing 3 items from 10 is the same count as choosing 7 items from 10, because every group of 3 chosen implies a group of 7 left behind.
  • Factorials of large numbers produce very large results. Our calculator handles big integers, but keep in mind that 170! already exceeds the range of standard floating-point numbers.
  • In programming, many languages provide factorial or combinatorial functions in their math libraries: Python’s math.factorial(), math.comb(), and math.perm() are commonly used.

Frequently Asked Questions

Why is 0! equal to 1? By convention and mathematical consistency. The number of ways to arrange zero items is exactly one way: do nothing. It also ensures that formulas like C(n, 0) = 1 and P(n, 0) = 1 work correctly.

What is the largest factorial I can calculate? Our tool supports large values of n. Practically, results beyond about 170! exceed the range of standard 64-bit floating-point numbers, but the calculator uses big integer arithmetic to handle values well beyond that.

What is the difference between permutations and combinations? Permutations count ordered arrangements (ABC is different from CBA). Combinations count unordered selections (ABC is the same as CBA). Use permutations when sequence matters, combinations when it does not.

Can r be larger than n? No. You cannot choose more items than are available. P(n, r) and C(n, r) are only defined when r is less than or equal to n.

How are factorials used in probability? Factorials are the foundation of counting formulas in probability theory. The probability of an event is often calculated as the number of favorable outcomes divided by the total outcomes, and both counts frequently involve factorials, permutations, or combinations.


Try our free Factorial Calculator to calculate factorials, permutations, and combinations instantly.

Try Ghost Image Hub

The Chrome extension that makes managing your Ghost blog images a breeze.

Learn More