Permutation and Combination Calculator

Enter n and r to get every permutation and combination count — nPr, nCr, nr and combinations with repetition — exactly, with the formula worked out step by step. Runs entirely in your browser.

Ad Space

Permutation and combination are the two basic ways of counting selections of r items from a set of n. A permutation counts ordered arrangements, nPr = n! / (n − r)!; a combination counts unordered groups, nCr = n! / [r! × (n − r)!]. Choosing 3 of 10 people gives 720 permutations but only 120 combinations, because each group of 3 can be ordered 3! = 6 ways.

How to Use the Permutation and Combination Calculator

  1. Enter n, the total number of distinct items (0 to 1,000).
  2. Enter r, how many items you choose or arrange.
  3. Press Calculate. You get all four counts at once — nPr, nCr, nr (order matters, repetition allowed) and C(n + r − 1, r) (order does not matter, repetition allowed) — plus the formula with your numbers substituted.

Results use exact whole-number arithmetic (JavaScript BigInt), so large answers such as 100P10 = 62,815,650,955,529,472,000 are exact, not rounded floating-point estimates. Nothing you type leaves your browser.

Understanding Permutations and Combinations

Permutations and combinations are fundamental counting techniques in mathematics used to determine the number of possible arrangements or selections from a set of items. They appear everywhere — from probability and statistics to cryptography, genetics, and game theory.

The key distinction is straightforward: permutations care about order, while combinations do not. Choosing Alice, Bob, and Carol for president, vice-president, and treasurer is a permutation problem (ABC differs from BAC). Choosing 3 people for a committee is a combination problem (the same group regardless of order).

Formulas

Permutation: nPr = n! / (n - r)!

Combination: nCr = n! / [r! × (n - r)!]

Where:

  • n = total number of items
  • r = number of items chosen
  • n! = n factorial = n × (n-1) × (n-2) × ... × 1

Permutation and Combination Formula Table (4 Cases)

Two questions decide which formula applies: does order matter? and can an item be picked more than once? The last column uses n = 10, r = 3.

Order matters?Repetition?NameFormulan = 10, r = 3
YesNoPermutation (nPr)n! / (n − r)!720
NoNoCombination (nCr)n! / [r! × (n − r)!]120
YesYesPermutation with repetitionnr1,000
NoYesCombination with repetitionC(n + r − 1, r)220

The repetition formulas follow the standard treatment in Joy Morris, Combinatorics, University of Lethbridge, ch. 5 “Counting with Repetitions”: with unlimited repetition there are nr ordered choices and C(n + r − 1, r) unordered ones (the “stars and bars” argument).

Worked Example: 3 of 10 People and 5-Card Hands

Choosing 3 of 10 people. If the three get distinct roles (chair, secretary, treasurer), order matters: 10P3 = 10 × 9 × 8 = 720. If they simply form a committee, order does not matter, so divide by the 3! = 6 orderings of each group: 10C3 = 720 / 6 = 120.

5 cards from a standard 52-card deck. A hand is the same no matter the order the cards arrive, so it is a combination:

StepWorkingValue
1. Ordered draws (52P5)52 × 51 × 50 × 49 × 48311,875,200
2. Orderings of one hand (5!)5 × 4 × 3 × 2 × 1120
3. Distinct hands (52C5)311,875,200 / 1202,598,960

Real-World Examples

Difference Between Permutation and Combination

Ask one question: “If I swap two of the chosen items, do I get a different outcome?” If yes, it is a permutation; if no, a combination. A PIN 1234 differs from 4321 (permutation), but a hand {A, K, Q} is the same in any order (combination).

SituationOrder matters?TypeCount
4-digit lock code, digits may repeatYesPermutation with repetition104 = 10,000
4-digit code, no repeated digitsYesPermutation10P4 = 5,040
Draw of 6 numbers from 49NoCombination49C6 = 13,983,816
Committee of 3 from 10 peopleNoCombination10C3 = 120
Gold, silver, bronze from 8 runnersYesPermutation8P3 = 336
3 scoops from 5 flavours, repeats allowedNoCombination with repetitionC(7, 3) = 35

Note that a so-called “combination lock” is really a permutation with repetition: 1-2-3-4 and 4-3-2-1 open different locks.

Factorials Explained

A factorial (written as n!) is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention, 0! = 1. Factorials grow extremely fast — 20! is already over 2.4 quintillion. Ordinary floating-point numbers lose exact digits beyond about 9 × 1015 (253), so this calculator uses BigInt integer arithmetic and stays exact for any n up to 1,000.

Applications

Combinatorics underpins probability theory, statistical sampling, algorithm design (sorting, hashing), error-correcting codes, DNA sequencing, and tournament scheduling. Understanding permutations and combinations is essential for standardised tests like the GRE, GMAT, SAT, and competitive programming contests.

Last updated: October 2026

Frequently Asked Questions

What is the difference between permutation and combination?

A permutation counts arrangements where order matters (e.g., ranking 3 people out of 10). A combination counts selections where order does not matter (e.g., choosing 3 people for a committee out of 10). The formula for permutations includes the extra ordering factor, making nPr always greater than or equal to nCr.

What does n and r mean?

n is the total number of items in the set, and r is the number of items being chosen or arranged. For example, if you have 10 students and want to pick 3, then n = 10 and r = 3.

When should I use permutations?

Use permutations when the order of selection matters. Examples include ranking contestants, assigning positions, creating passwords, or arranging books on a shelf where each position is distinct.

When should I use combinations?

Use combinations when the order does not matter. Examples include choosing a committee, selecting lottery numbers, picking a team of players, or choosing toppings for a pizza.

Why is nPr always greater than or equal to nCr?

Because nPr counts every distinct ordering of the r items as a separate arrangement, while nCr treats all orderings of the same r items as one group. Mathematically, nPr = nCr × r!, so nPr is always r! times larger than nCr.

How do you know if it is a permutation or a combination?

Ask whether swapping two chosen items gives a different outcome. If it does (a PIN, a race podium, assigned roles), use a permutation, nPr = n! / (n − r)!. If it does not (a committee, a hand of cards, a set of drawn numbers), use a combination, nCr = n! / [r! × (n − r)!].

What is the formula for permutation with repetition?

When order matters and items can repeat, each of the r positions has n choices, so the count is n^r. A 4-digit code using digits 0-9 has 10^4 = 10,000 possibilities. If order does not matter but repetition is allowed, use C(n + r − 1, r) instead, e.g. 3 scoops from 5 flavours = C(7, 3) = 35.