Skip to main content

Combination and permutation calculator

Count selections of k items from n distinct items.

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Enter n and k, then choose whether the same item may be selected more than once.

Combinations: order ignored
—

Permutations: order matters
—

Was this tool useful?

How does this tool work?

Choosing three people for a team and awarding three places on a podium give different counts. Swapping two names does not change a team, but it does change a ranking. This calculator distinguishes those situations and also lets you choose the same item again. It counts possible selections without listing them.

Two questions determine the model: does order matter, and can an item be chosen more than once? Without repetition, a chosen item is no longer available for later positions. With repetition, it remains available at every choice, as a digit does in a code. The n starting items are treated as distinct.

The calculator shows both combinations, where only the final group matters, and ordered selections, also called partial permutations when repetition is not allowed. A full permutation is the special case where you arrange all items: k = n. AB and BA are different ordered selections but represent a single combination.

The factorial n! multiplies the integers from 1 to n: 4! = 4 × 3 × 2 × 1 = 24. Without repetition, dividing the ordered count by k! removes the different orders of each group. Calculations use exact integers; the scientific order of magnitude shown beside a large result is approximate.

How to use this tool

  1. Define the selection

    Enter the number of available items n and the selection size k.

  2. Set repetition

    Allow repetition only when each item remains available after it is chosen.

  3. Compare both counts

    Use combinations when order does not matter, or ordered selections when every position matters.

Choose a formula by order and repetition

Order ignored, without repetition

C(n,k) = n! / (k! (n−k)!)

Choose a committee of k people from n, without assigning roles. This expression assumes 0 ≤ k ≤ n.

Order matters, without repetition

P(n,k) = n! / (n−k)!

Assign k distinct places among n candidates, with each candidate taking at most one place.

Order ignored, with repetition

C(n+k−1,k)

For n ≥ 1, choose k items from n types with unlimited availability. AAB and ABA then represent the same selection.

Order matters, with repetition

n^k

Fill k positions using n symbols available at each position. AAB and ABA are then two different sequences.

n
Number of distinct items or available types.
k
Number of items chosen or positions to fill.

Use cases

Choose a committee

Count possible teams when swapping members does not change the selected group.

Assign positions

Count podiums or distinct roles where swapping two people changes the outcome.

Build a code

Count symbol sequences while allowing the same symbol to appear more than once.

Examples

A committee or a podium from five people

A three-person committee gives 10 groups. Awarding gold, silver and bronze gives 60 rankings: each of the 10 groups has 3! = 6 possible orders. The settings are the same; what changes is which result you use.

Input

n = 5
k = 3
Repetition: no

Result

Combinations: 10
Ordered selections: 60

Two letters from A, B and C, with repetition

Ignoring order, the six choices are AA, AB, AC, BB, BC and CC. If each position matters, BA, CA and CB add three possibilities. There are therefore 3 × 3 = 9 sequences, but only six groups with repetition.

Input

n = 3
k = 2
Repetition: yes

Result

Combinations: 6
Ordered selections: 9

A four-digit code

For a code, order matters: use 10,000, including 0000 and codes starting with zero. If the first digit has a different restriction, not all positions have the same choices and these settings alone are insufficient.

Input

n = 10
k = 4
Repetition: yes

Result

Combinations: 715
Ordered selections: 10,000

Tips and best practices

  • Inputs must be integers from 0 to 1,000. Without repetition, asking for more items than are available gives zero possibilities.
  • A condition such as “at least one vowel” or “these two people cannot be together” needs additional reasoning; it cannot be inferred from n and k.
  • For a fixed collection with duplicate items, such as the letters in a word, do not confuse identical objects with permission to choose an item again.

Sources and references

Frequently asked questions

When does order matter?

If swapping two items changes the outcome, use permutations: ABC and BAC differ. For a team containing the same people, both spellings describe one combination.

Why does an empty choice count as one?

There is one way to select nothing: the empty selection. This also agrees with 0! = 1.

Can I list every group?

No. This tool calculates the count only; generating every group quickly becomes far more expensive.

Does repetition mean some starting items are identical?

No. It allows the same item to be chosen again. Counting arrangements of a fixed collection containing duplicate items is a different problem.

Can I use the result as a probability?

The result counts possibilities. To calculate a probability, you also need to define favourable outcomes and check that the outcomes being compared are equally likely. A large combination count alone says nothing about the chance of an event.

Related tools

Tools similar or complementary to this one.

Similar tools

Add, subtract, multiply, divide and simplify fractions, with every step shown.

Mathematics & calculationNewFeaturedUse this tool