Math calculator

Free permutation and combination calculator

Calculate permutations P(n,r) and combinations C(n,r) — enter n and r to see how many ordered or unordered selections are possible, updated live, as you type.

InputsLive
n (total items)
Non-negative integer
r (chosen items)
Must be ≤ n
Result
Combinations C(n,r)
120
P(n,r) = n!/(n-r)! = 720
Combinations C(n,r)120
Permutations P(n,r)720
n10
r3

C(n,r) = n! / (r! × (n−r)!). P(n,r) = n! / (n−r)!.

Results are estimates. Consult a professional.

How it's calculated

How the permutation and combination calculator works

Permutations count the number of ways to arrange r items chosen from n items when order matters. Combinations count the number of ways to select r items from n when order does not matter. Both use the factorial function n! = n × (n−1) × … × 1.

Permutations (order matters):
P(n, r) = n! / (n r)!
Combinations (order does not matter):
C(n, r) = n! / (r! × (n r)!)
Relationship: C(n, r) = P(n, r) / r!
OpenStax Introductory Statistics — Combinations and Permutations
Example

Worked example: 5 people, 3 positions

Example: choose 3 from 5 people — with and without order

Five candidates (A, B, C, D, E) are available. In scenario 1, you assign them to 3 ranked roles (1st, 2nd, 3rd). In scenario 2, you form a 3-person committee where roles are equal.

Permutations (ranked roles, order matters):
P(5, 3) = 5! / (53)! = 120 / 2 = 60 arrangements
Combinations (committee, order doesn't matter):
C(5, 3) = 5! / (3! × 2!) = 120 / (6 × 2) = 10 groups
Verify: 60 / 3! = 60 / 6 = 10 ✓
P(5,3) = 60 · C(5,3) = 10
When order matters you get 60 outcomes; when it doesn't, only 10. The difference is a factor of 3! = 6.
Quick reference

P(n,r) and C(n,r) values for n = 5 to 8

The table gives exact counts for common small values. Use these to double-check your inputs or quickly look up an answer.

nrP(n,r)C(n,r)
522010
536010
623015
6312020
724221
7321035
825628
8333656

Computed using P(n,r) = n!/(n−r)! and C(n,r) = n!/(r!(n−r)!)

Practical tips

Tips for permutations and combinations

The most common mistake is choosing the wrong formula. Ask yourself one question first: does the order of selection change the outcome?

  • Ask "does order matter?" — ranking, scheduling, and passwords → permutations; teams, committees, and subsets → combinations.
  • Repetition changes the formula — if items can be reused (e.g. a 4-digit PIN with repeated digits), use nʳ for permutations with repetition.
  • C(n,r) = C(n, n−r) — choosing 3 from 10 gives the same number of groups as choosing 7 from 10; use the smaller r for easier calculation.
  • Factorials grow very fast — 13! exceeds 6 billion; for large n use logarithms or Stirling's approximation to avoid overflow.
  • Tree diagrams help small problems — for n ≤ 4 draw a tree to verify your formula answer before generalising.
Accuracy & limits

Accuracy and limitations

Factorials produce exact integer results for small inputs but grow extremely rapidly: 21! exceeds the maximum safe integer in 64-bit double precision (2⁵³ ≈ 9 × 10¹⁵). This calculator uses arbitrary-precision integer arithmetic for n up to 170 (the largest n for which n! is finite in double precision). For n > 170, results switch to scientific notation and may lose the last few digits of precision. The formulas assume sampling without replacement; enable the repetition option for sampling with replacement.

Glossary

Key terms

An ordered arrangement of r items selected from n distinct items; swapping positions creates a new permutation.
An unordered selection of r items from n; the same set in a different order counts as the same combination.
The product of all positive integers from 1 to n; e.g. 5! = 120. By definition 0! = 1.
The size of the pool or population from which items are selected.
The number of items selected or arranged at a time; must satisfy 0 ≤ r ≤ n.
Once an item is chosen it cannot be chosen again; the default assumption for P(n,r) and C(n,r).
About

About this calculator

Part of our math calculators suite — explore all calculators.

Questions

Frequently asked questions about the free permutation and combination calculator

A permutation and combination calculator is a free online tool that helps you count arrangements (order matters: P(n,r)) and selections (order doesn't: C(n,r)). Permutations count ORDERED arrangements; combinations count UNORDERED selections. The relationship is simple: C(n, r) = P(n, r) ÷ r!. It runs entirely in your browser with instant results and no sign-up.
Use permutations when ORDER MATTERS — e.g. assigning gold/silver/bronze to 3 of 10 athletes (gold-Alice differs from silver-Alice). Use combinations when ORDER DOESN'T — e.g. picking a 5-person committee from 20 candidates (any 5 is the same committee, regardless of order chosen).
By symmetry. Choosing r items to INCLUDE is the same as choosing n − r items to EXCLUDE. So C(10, 3) = C(10, 7) = 120 — same value, two equivalent ways to count.
Up to n ≈ 170 before JS doubles overflow to Infinity for n!. For combinations, you can often go further before the result overflows even when n! itself does.

Want a calculator built for your business?

Customize any of our 400+ tools to match your brand, or commission a new one tailored to how your business actually calculates — pricing, payroll, quotes, anything. Deployed on your domain, math runs in your visitors' browsers.