Permutations and combinations calculator

Count arrangements and choices with or without repetition, multinomials, circular orders and derangements, with the formula and what it counts.

How it works

Most counting questions come down to two choices: does the order matter, and may an object be repeated? Choosing $k$ things from $n$ gives four answers. With order and without repetition there are $P(n, k) = n (n-1) \cdots (n-k+1)$ arrangements; with order and repetition there are $n^k$ sequences; without order and without repetition there are $\binom{n}{k}$ combinations; without order but with repetition there are $\binom{n+k-1}{k}$ multisets, by the stars and bars argument.

Arranging all $n$ objects gives $n!$ permutations. When some objects are alike, orders that only swap alike objects are the same, which gives the multinomial coefficient $\frac{n!}{k_1! \, k_2! \cdots}$: the word MISSISSIPPI has $\frac{11!}{1! \, 4! \, 4! \, 2!} = 34650$ distinct anagrams. Around a round table, rotations are the same seating, which leaves $(n-1)!$. A derangement is an order where nothing is in its original place; there are about $n!/e$ of them.

In cryptography these numbers measure key spaces: a simple substitution cipher has $26! \approx 2^{88}$ keys, far too many to try one by one, which is why it is broken by frequency analysis instead.

Everything is calculated in your browser. Nothing you type leaves your device.