Math & ScienceExact big integers

Permutation & Combination Calculator

The only question that matters is whether order counts. If ABC and CBA are different outcomes you want permutations; if they are the same selection you want combinations. Everything else follows from that.

Selection

n is the pool size, r is how many you take.

COMBINATIONS — C(n, r)
Permutations — P(n, r)
Combinations with repetition
Permutations with repetition — nʳ
n factorial
r factorial
Total subsets of n — 2ⁿ
Odds of one specific combination
Order matters by a factor of

Order matters, or it does not

A permutation counts arrangements: first, second and third place in a race are three different outcomes depending on who finishes where. P(n, r) = n! / (n − r)!.

A combination counts selections: a committee of three people is the same committee whichever order you list them in. C(n, r) = n! / (r!(n − r)!). The extra r! in the denominator divides out every rearrangement of the same group — which is exactly the ratio the calculator reports.

With repetition, and why the formula looks odd

If an item can be chosen more than once — a four-digit PIN, an ice cream with three scoops from eight flavours — the counts change. Ordered with repetition is simply nr, because every position independently has n choices. Unordered with repetition is C(n + r − 1, r), the "stars and bars" result, and it is the one people almost never guess correctly.

A worked example: the lottery

Choosing 6 numbers from 49 where order does not matter gives C(49, 6) = 13,983,816. That is the odds of a jackpot on one ticket. If order did matter it would be P(49, 6) = 10,068,347,520 — 720 times larger, which is 6!, the number of ways to shuffle any single winning set. Seeing those two numbers side by side is the fastest way to internalise what the r! is doing.

Why this uses exact arithmetic

Factorials grow faster than anything else in elementary maths. 21! already exceeds the largest integer JavaScript can represent exactly, so ordinary floating-point calculators start returning approximations without saying so. This page computes with arbitrary-precision integers and only falls back to scientific notation when a result is genuinely too long to display — the digits it shows are the real ones.

Frequently Asked Questions

What is the difference between a permutation and a combination?
Permutations count ordered arrangements, combinations count unordered selections. For the same n and r, the number of permutations is always r! times larger than the number of combinations.
What is 0 factorial?
0! equals 1, by definition and by necessity. There is exactly one way to arrange nothing, and the combination formula would break at the edges without it — C(n, n) must equal 1.
Why is C(n, r) the same as C(n, n − r)?
Choosing which r items to take is identical to choosing which n − r items to leave behind. Every selection has a matching rejection, so the two counts must be equal. It is also the symmetry you see in Pascal’s triangle.
Can r be larger than n?
Not for selections without repetition — you cannot pick eight items from a pool of five, so the result is zero. With repetition it is perfectly valid, which is why those two fields still return values.
Where these numbers come from

Sources

Official publications only. Links open the original document in a new tab.