Combinations & Permutations Calculator
Calculate combinations (nCr), permutations (nPr) and factorials with the formula expanded for each result.
🔒 Runs entirely in your browser — nothing is uploadedCounting with factorials
Combinatorics answers the question "how many ways?" and it is built on the factorial. The factorial of n, written n!, multiplies every whole number from 1 up to n, and by definition 0! = 1. A factorial counts how many ways you can arrange n distinct items in a row: there are 5! = 120 orderings of five different books on a shelf. Factorials grow extremely fast, which is why even modest values produce huge counts. This calculator shows the factorial directly and also uses it inside the combination and permutation formulas.
Permutations count ordered selections. Choosing r items from n where order matters uses nPr = n! ÷ (n − r)!. Combinations count unordered selections, where a group is the same regardless of order, and use nCr = n! ÷ (r! × (n − r)!). Because every combination can be arranged in r! orders, the two are linked by nPr = nCr × r!. That is why permutations are always greater than or equal to the matching combinations. The widget expands the chosen formula under the answer so you can follow exactly how the count was produced.
When to use each
Use permutations when order matters: finishing positions in a race, seat arrangements, PIN digits, or the order songs play in a playlist. Use combinations when order does not matter: lottery picks, a hand of cards, choosing a committee, or selecting toppings for a pizza. A quick test is to ask whether swapping two chosen items creates a genuinely different outcome — if yes, it is a permutation; if no, it is a combination. Remember that r cannot exceed n, since you cannot pick more items than exist, and the calculator validates that for you. Because results rely on standard JavaScript numbers, very large factorials become approximate and eventually overflow to infinity, but for typical probability, statistics and homework problems the values are exact and computed entirely on your device.
How to use
- Choose an operationPick combinations (nCr), permutations (nPr) or a single factorial (n!).
- Enter n and rType the total items n and, for nCr or nPr, how many you choose, r. The r field hides for factorials.
- Read the countThe result and the expanded formula update instantly so you can check the working.