Permutation & Combination Calculator
Calculate nPr (permutations) and nCr (combinations) from n and r — how many ways to arrange or choose items, with exact factorial values, computed precisely for large n using arbitrary-precision arithmetic.
Input
r cannot exceed n.
Output
| Metric | Value |
|---|---|
| No data yet | |
Guides
The Permutation & Combination Calculator works out how many ways you can arrange or choose items from a set, given a total count n and a chosen count r. Enter both numbers and the tool instantly returns the permutation count P(n, r), the combination count C(n, r), and the three factorials behind them — n!, r!, and (n − r)! — all computed exactly, even for large values of n.
What's the difference between a permutation and a combination?
Permutations count arrangements where order matters. If you're handing out 1st, 2nd, and 3rd place medals to 10 racers, swapping who gets gold and silver produces a genuinely different outcome — that's a permutation problem.
Combinations count selections where order doesn't matter. If you're picking 3 people out of 10 for a committee, it doesn't matter which one you "picked first" — the same 3 people form the same committee regardless of order. That's a combination problem.
Every permutation count is at least as large as the matching combination count, because permutations count every reordering of each combination separately.
The formulas
- Permutations: P(n, r) = n! / (n − r)!
- Combinations: C(n, r) = n! / (r! × (n − r)!)
Where n! ("n factorial") is the product of all positive integers up to n (5! = 5 × 4 × 3 × 2 × 1 = 120), and by convention 0! = 1.
Both formulas require r ≤ n — you can't arrange or choose more items than you have.
How to use the calculator
- Enter n, the total number of items in your set.
- Enter r, the number of items you're arranging or choosing.
- The results table updates automatically, showing P(n, r), C(n, r), and the three underlying factorials.
The tool validates that both n and r are non-negative whole numbers and that r doesn't exceed n, catching the two most common input mistakes before they produce a nonsensical result.
Exact results, even for large n
Factorials grow explosively — 20! already exceeds what a standard JavaScript number can represent exactly, and 100! runs to 158 digits. This calculator uses arbitrary-precision integer arithmetic internally, so results stay exact rather than rounding once numbers get large. You can safely calculate P(100, 50) or C(1000, 3) and trust every digit of the answer.
When would I use a permutation vs. a combination?
Use a permutation whenever the arrangement or sequence itself matters — ranking race finishers, assigning distinct roles, or generating password-style sequences. Use a combination whenever you're simply selecting a group and the internal order is irrelevant — choosing a committee, a lottery draw, or a hand of cards.
What does r = 0 or r = n mean?
Choosing 0 items from any set has exactly one outcome (the empty selection), so P(n, 0) = C(n, 0) = 1 for any n. Choosing all n items has exactly one combination (the whole set), so C(n, n) = 1, while P(n, n) = n! since every full arrangement is a distinct permutation.
Does this run in my browser?
Yes — all calculations happen locally in your browser (or via the API if you call it that way). No data about your n and r values is sent anywhere beyond what's needed to load the page.