Combinations & Permutations Calculator

Compute nCr, nPr, and factorials instantly in your browser.

Free combinations and permutations calculator — work out nCr (combinations), nPr (permutations), and factorials. All math runs locally in your browser with nothing uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between combinations and permutations?

Permutations count arrangements where order matters (nPr), while combinations count selections where order does not matter (nCr). For the same n and r, nPr is always greater than or equal to nCr.

This calculator counts the number of ways to choose or arrange items — the core of combinatorics and probability. It handles three operations: combinations (nCr) where order does not matter, permutations (nPr) where it does, and plain factorials (n!). It is useful for lottery odds, password-strength sums, statistics homework and any “how many ways” question.

How it works

The three modes use standard combinatorial formulas:

  • Factorial: n! = n × (n−1) × … × 2 × 1, the number of orderings of n items.
  • Permutations: nPr = n! ÷ (n − r)!, computed iteratively as n × (n−1) × … × (n−r+1) to avoid overflow.
  • Combinations: nCr = n! ÷ [r! × (n − r)!], computed step by step (using the smaller of r and n−r) so larger inputs stay accurate.

Because order matters in permutations but not in combinations, nPr is always at least as large as nCr for the same n and r.

Example

Choosing 3 items from 10:

nCr(10, 3) = 10! ÷ (3! × 7!) = 120 nPr(10, 3) = 10 × 9 × 8 = 720

So there are 120 unordered selections but 720 ordered arrangements — the permutation count is 3! = 6 times larger, because each combination can be ordered in 6 ways.

Choose a mode, enter your values for n and r, and the result appears instantly — all computed locally in your browser with nothing uploaded.

Real-world applications

Lottery odds — a 6-from-49 lottery uses combinations, since the order the balls come out doesn’t matter. nCr(49, 6) gives the total number of possible tickets: 13,983,816. That is your denominator for calculating the probability of a jackpot win.

Password and PIN strength — a 4-digit PIN drawn from 10 digits (0–9) with no repeats uses permutations: nPr(10, 4) = 5,040 possible PINs. If repeats are allowed, it is simply 10^4 = 10,000. The permutation count is lower because eliminating repeats reduces the pool.

Team selection — choosing 5 players from a squad of 15 for a starting lineup where roles are not assigned uses combinations: nCr(15, 5) = 3,003 ways. If you are assigning 5 players to 5 specific positions (goalkeeper, defender, etc.), you need permutations: nPr(15, 5) = 360,360.

Card hands — a 5-card poker hand from a 52-card deck: nCr(52, 5) = 2,598,960 possible hands. Order doesn’t matter in a dealt hand, so combinations apply.

A/B testing variants — if you have 8 design elements and want to test all pairs simultaneously, nCr(8, 2) = 28 pairs. Knowing this number upfront prevents experimental designs that grow unmanageable.

Understanding the relationship between nCr and nPr

For any n and r, nPr = nCr × r!. This makes intuitive sense: for every unordered combination of r items, you can arrange those same items in r! different orders, each arrangement being a distinct permutation. For example, choosing 3 from 10: nCr(10, 3) = 120 and nPr(10, 3) = 720 = 120 × 3! = 120 × 6.

Edge cases to know

  • nCr(n, 0) = 1 for any n — there is exactly one way to choose nothing.
  • nCr(n, n) = 1 — there is exactly one way to choose all items.
  • nCr(n, 1) = n — choosing a single item from n has n possibilities.
  • Factorials grow extremely fast: 20! is about 2.4 × 10^18. The calculator handles moderately large inputs using iterative multiplication to avoid overflow, but very large factorials (above ~170) exceed JavaScript’s number range.