Permutation and Combination Calculator

Free permutation and combination calculator. Compute nPr (ordered arrangements) and nCr (unordered selections) from a set of n items taken r at a time.

AI-ready Use this tool with AI

This tool has a free JSON API. Copy a prompt or skill below to use it with ChatGPT, Claude, or any AI agent — no API key needed.

API docs
Enter n and r above.

How permutation and combination calculator works

Permutations and combinations both count the ways to choose r items from a set of n, but they differ in whether order matters. A permutation counts ordered arrangements (nPr = n! / (n−r)!) — picking a president then a vice-president. A combination counts unordered selections (nCr = n! / (r! × (n−r)!)) — picking a committee of two where roles do not matter.

Because order matters in permutations but not combinations, nPr is always greater than or equal to nCr for the same n and r. The combination formula divides the permutation formula by r!, removing the r! ways to reorder each chosen group. Both reduce to 1 when r is 0 (one way to choose nothing) and are undefined when r exceeds n.

Enter n (the total number of items) and r (how many to choose), then pick Permutation, Combination, or Both. The calculator evaluates the factorials and reports the result. It is commonly used in probability, statistics, lottery odds, and counting problems in discrete mathematics.

Frequently asked questions

What is the difference between permutation and combination?
In a permutation order matters (nPr = n! / (n−r)!); in a combination it does not (nCr = n! / (r!(n−r)!)). Choosing a president and VP is a permutation; choosing a 2-person committee is a combination.
What are the formulas?
nPr = n! / (n−r)! and nCr = n! / (r! × (n−r)!). For n=5, r=2: P(5,2) = 20 and C(5,2) = 10, because each pair can be ordered 2! = 2 ways.
Why is nCr always ≤ nPr?
Because the combination formula divides by r! extra. Each unordered group of r items has r! ordered permutations, so nCr = nPr / r!. For r=0 both equal 1.
What happens if r > n?
It is impossible to choose more items than exist, so the calculator reports an error. Both nPr and nCr are only defined for 0 ≤ r ≤ n.