Combinatorics Calculator
Compute combinations nCr, permutations nPr and factorials with the formulas shown, using mathjs.
🔒 Runs entirely in your browser — nothing is uploadedCounting selections and arrangements
Combinatorics is the mathematics of counting how many ways something can happen, and two ideas do most of the work: combinations and permutations. A combination, written nCr, counts how many ways you can choose r items from a set of n when the order of the chosen items does not matter. A permutation, written nPr, counts how many ways you can choose and arrange r items from n when order does matter. This calculator reports both at once, along with the factorial of n, and shows the formula it used so the result is easy to verify.
The formulas are closely linked. The factorial n! = n × (n − 1) × … × 2 × 1 counts the arrangements of all n items. From it, the number of permutations is nPr = n! / (n − r)!, which removes the arrangements of the items you did not pick. Combinations then divide out the orderings of the chosen items, giving nCr = n! / (r! × (n − r)!). Because order is ignored, nCr is always less than or equal to nPr, and the two are equal only when r is 0 or 1.
Where these counts appear
These counts show up everywhere. Lottery odds, card-hand probabilities and committee selections use combinations because the order of the result is irrelevant. Passwords, race finishing orders and seating plans use permutations because rearranging the same items produces a different outcome. Factorials anchor both and also appear in probability distributions and series expansions. Recognizing whether order matters is the key decision: if swapping two items changes the outcome, use permutations; if it does not, use combinations.
Limits and privacy
Factorials grow extremely fast, so large values of n quickly exceed the range where ordinary numbers stay exact and may be shown in scientific notation or flagged as too large. For exact counts with big inputs, use arbitrary-precision software. Within the everyday range used in classes and probability problems, the results here are exact. All arithmetic runs in your browser with mathjs; the values you enter are never uploaded, stored or shared.
How to use
- Enter n and rSet n for the total number of items and r for how many you choose or arrange.
- Read the countsSee combinations nCr, permutations nPr and the factorial n! together.
- Check the formulasThe worked formula shows exactly how each count is derived.