Permutation and Combination Calculator (nPr, nCr)
Work out permutations (nPr) and combinations (nCr) for any whole numbers, with or without repetition. You get the exact count, the factorial formula expanded with your own numbers, and all four standard cases side by side — no signup, no ads, sources cited.
How it works
A permutation counts arrangements where order matters; a combinationcounts selections where order does not. Whether items may be reused (“with repetition”) splits each of those into two, giving four standard cases. All of them are built from the factorial, defined by n! = n × (n − 1) × … × 2 × 1 with the convention 0! = 1 (NIST DLMF §5.2).
- Permutation, no repetition — order matters, each item used once:
P(n, r) = n! / (n − r)!. This counts the falling product n × (n − 1) × … × (n − r + 1) (NIST/SEMATECH §3.3). - Permutation, with repetition — order matters, items may repeat:
n^r, because each of the r positions is chosen independently from all n items. - Combination, no repetition — order does not matter, each item used once:
C(n, r) = n! / (r! · (n − r)!)(NIST DLMF §26.1). Dividing nPr by r! removes the r! orderings that a combination treats as identical. - Combination, with repetition — order does not matter, items may repeat:
C(n + r − 1, r), the multiset or “stars and bars” count.
The calculator computes every count with BigInt integer arithmetic, so there is no floating-point error. For combinations it uses the cancellation-based loop ∏ (n − r + i) / i and exploits the symmetry C(n, r) = C(n, n − r), which keeps the work small and the intermediate values exact (each step is itself a whole binomial coefficient). Permutations use the direct falling product rather than dividing two huge factorials. When repetition is off and r exceeds n, the result is 0 — you cannot draw more distinct items than exist, matching the NIST convention C(n, k) = 0 for k > n. The four cases are always shown together so you can see, for the same n and r, how arrangements compare with selections and how repetition changes each.
Worked examples
Frequently asked questions
Sources & references
- NIST Digital Library of Mathematical Functions §5.2 — Factorial (defines n! and 0! = 1)
- NIST DLMF §26.1 — Binomial coefficients (defines C(n, k); C(n, k) = 0 for k > n)
- NIST/SEMATECH e-Handbook of Statistical Methods §3.3 — Permutations and combinations
The formulas and worked examples on this page were last cross-checked against the cited NIST sources on 2026-06-27. Combinatorics here is defined on non-negative integers only, per those conventions.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.