Skip to content
CalcSpectrum

Combination & Permutation Calculator

Calculate combinations (nCr) or permutations (nPr) exactly. Enter n and r to find how many ways to choose or arrange items, with the exact result and formula used — no floating-point overflow, even for large values.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

nCr = \dfrac{n!}{r!(n-r)!}
 nPr = \dfrac{n!}{(n-r)!}

Combinations and permutations both count the number of ways to select r items out of a total of n items — the difference is whether order matters. A combination (nCr, also written C(n, r) or "n choose r") counts selections where order does NOT matter: choosing {A, B, C} is the same result as choosing {C, B, A}. A permutation (nPr, also written P(n, r)) counts arrangements where order DOES matter: placing A, then B, then C is a different outcome from placing C, then B, then A. Because permutations count every ordering of each combination separately, nPr is always greater than or equal to nCr for the same n and r — specifically, nPr = nCr × r!. This calculator computes both formulas exactly, using arbitrary-precision integer arithmetic rather than ordinary floating-point math, so results stay exact even when n and r are large enough that a naive factorial calculation would silently lose precision.

Worked Examples

Combination: choosing 2 people from a group of 5 (5C2)

  1. Formula: C(5, 2) = 5! / (2! × (5 - 2)!) = 5! / (2! × 3!)
  2. Expand: (5 × 4 × 3 × 2 × 1) / ((2 × 1) × (3 × 2 × 1)) = 120 / (2 × 6) = 120 / 12
  3. Result: C(5, 2) = 10 — there are 10 distinct ways to choose 2 people from a group of 5, when the order they're chosen in doesn't matter.

Permutation: awarding 1st and 2nd place among 5 runners (5P2)

  1. Formula: P(5, 2) = 5! / (5 - 2)! = 5! / 3!
  2. Expand: (5 × 4 × 3 × 2 × 1) / (3 × 2 × 1) = 120 / 6
  3. Result: P(5, 2) = 20 — there are 20 distinct ways to award 1st and 2nd place among 5 runners, since who comes in 1st versus 2nd matters.

Frequently Asked Questions

What's the actual difference between a combination and a permutation?

Order. A combination counts groups where the order of selection is irrelevant (a committee of 3 people is the same committee no matter what order you picked them in). A permutation counts arrangements where order matters (1st, 2nd, and 3rd place are different outcomes even with the same 3 people). Every combination corresponds to r! different permutations, since there are r! ways to order any given group of r items.

Why does this calculator use r = 0 or r = n as valid inputs?

Both are meaningful boundaries, not errors. Choosing 0 items from n has exactly 1 way to do it — the empty selection — so both C(n, 0) and P(n, 0) equal 1. Choosing all n items with order ignored also has exactly 1 way (there's only one possible group: everything), so C(n, n) = 1; but arranging all n items in every possible order gives P(n, n) = n!, since order now matters for the full set.

Why is there a maximum value for n?

This calculator caps n at 1000 as a practical usability limit, not a mathematical one — the underlying arithmetic uses arbitrary-precision integers with no inherent size ceiling. At n = 1000, results can already run into hundreds of digits (C(1000, 500) has over 300 digits), which is about the practical limit of what's useful to display and read as a single number.

Why don't large values of n produce a rounded or approximate answer?

Because this calculator never computes a factorial as an ordinary floating-point number. Ordinary numeric types lose exact precision once a value exceeds about 9 quadrillion (2^53), which happens by n = 21 for a raw factorial. Instead, this calculator builds up the result using exact whole-number arithmetic the entire way through, so the final answer is always exact — never rounded — regardless of how large n and r are within the supported range.

Can r be larger than n?

No — you can't choose or arrange more items than exist in the total set, so r must be less than or equal to n. Entering r > n returns an invalid-input result rather than a number.