Toolkitbar

Permutation and Combination Calculator — nPr, nCr and Repeats

All four counts for n and r: ordered or not, repeats or not.

Runs on your device What you paste is processed by your own browser. It is never sent to a server, and it is not stored anywhere after you leave the page.

Short answer

Permutations and combinations can be calculated for free in a web browser by typing n and r on one line. Four counts come back together: permutations P(n, r), where order matters and nothing repeats; combinations C(n, r), where order does not matter; n^r for ordered selections with repetition; and C(n + r − 1, r) for unordered selections with repetition. Every count is computed with arbitrary-precision integers, so a result far beyond what floating point can represent exactly is still exact.

At a glance

AcceptsTwo whole numbers per line — n, then r
ProducesP(n, r), C(n, r) and both with-repetition counts
ProcessingIn your browser
PriceFree, no limits
AccountNot required

The hard part of a counting problem is never the arithmetic. It is deciding whether order matters and whether things may repeat — and getting that wrong turns one question into a different question with a plausible-looking answer. So all four counts come back at once, and the one you want is the row whose description matches the problem in front of you.

Exactness is the other half of it. C(52, 5) is 2,598,960 and fits anywhere, but P(40, 20) runs to 29 digits, and computing it as 40! ÷ 20! overflows a double long before the answer does. Everything here uses arbitrary-precision integers, and permutations are built as a falling product rather than a ratio of two factorials, so there is nothing to round.

How to use it

  1. 1

    Type n and r

    Two whole numbers per line — the size of the set, then how many are chosen: 52 5.

  2. 2

    Convert

    All four counts come back for each line, exactly.

  3. 3

    Pick the row that matches your problem

    Does the order they come out in matter, and can the same thing be picked twice? Those two answers choose the row.

  4. 4

    Copy the result

    Copy to the clipboard, or download it as a text file.

Frequently asked questions

What is the difference between a permutation and a combination?

Order. A permutation counts arrangements, so AB and BA are two of them; a combination counts selections, so they are one. Three runners taking first, second and third out of eight is P(8, 3) = 336. Three of eight people on a committee is C(8, 3) = 56.

When do the with-repetition rows apply?

When the same item can be chosen more than once. A four-digit PIN is 10^4 = 10,000 ordered selections with repetition. Three scoops from eight flavours, where repeats are allowed and the order in the bowl does not matter, is C(10, 3) = 120.

How large can n be?

500. Every count is exact, so the real limit is how long an answer is worth printing — 500! already has 1135 digits, and a larger n is refused rather than rounded.

Can it work out a factorial?

Yes: n! is P(n, n), so typing the same number twice gives it. The expression calculator also has a fact() function, for when a factorial is one part of a longer sum.

Related tools

Browse all maths tools →