# Permutation and Combination Calculator

URL: https://hifreetools.com/calculators/permutation-combination-calculator

> Compute permutations (nPr) and combinations (nCr) for any two whole numbers, along with the factorials n! and r!, instantly and with the formulas shown.

## Quick answer

Permutations count ordered arrangements with nPr = n! / (n − r)!, while combinations count unordered selections with nCr = n! / (r! · (n − r)!). For example, choosing 2 from 5 gives 5P2 = 120/6 = 20 ordered pairs but only 5C2 = 120/(2·6) = 10 unordered pairs. Permutations are always ≥ combinations because each unordered group of r items can be ordered in r! ways.

## Formula

- nPr = n! ÷ (n − r)!
- nCr = n! ÷ (r! × (n − r)!) = nPr ÷ r!
- 0! = 1, so nP0 = nC0 = nCn = 1

## Inputs

- n — total items (0 to 170); default 5
- r — items chosen (0 to 170); default 2

## Worked examples (computed by the page's own function)

- n — total items = 5, r — items chosen = 2 → Permutations nPr (order matters) = 20, Combinations nCr (order ignored) = 10, n! = 120, r! = 2  (5P2 = 5! ÷ 3! = 20; 5C2 = 5P2 ÷ 2! = 10)
- n — total items = 10, r — items chosen = 3 → Permutations nPr (order matters) = 720, Combinations nCr (order ignored) = 120, n! = 3628800, r! = 6  (10P3 = 10! ÷ 7! = 720; 10C3 = 10P3 ÷ 3! = 120)
- n — total items = 52, r — items chosen = 5 → Permutations nPr (order matters) = 311875200, Combinations nCr (order ignored) = 2598960, n! = 8.065817517094388e+67, r! = 120  (52P5 = 52! ÷ 47! = 311875200; 52C5 = 52P5 ÷ 5! = 2598960)

## Verification

Checked against 17 reference cases (expected values computed independently). Reviewed 2026-10-27. Latest change 2026-10-28: Moved to the schema renderer with a sourced ledger; nPr and nCr are now counted exactly (BigInt) and rounded once, so results below 2⁵³ are exact even when n! is not. n is capped at 170 (171! overflows), and r > n shows a field error.

## FAQ

**What is the difference between a permutation and a combination?**
A permutation counts arrangements where order matters, while a combination counts selections where order does not. Picking 1st, 2nd and 3rd place from 10 runners is a permutation (10P3 = 720); picking any 3 finalists is a combination (10C3 = 120). Because each group of r items can be ordered r! ways, nPr is always r! times larger than nCr.

**How do I calculate nPr by hand?**
Use nPr = n! / (n − r)!. In practice you just multiply the r largest descending factors of n: nPr = n · (n−1) · … · (n−r+1). For example 7P2 = 7 · 6 = 42, and 10P3 = 10 · 9 · 8 = 720. There is no need to compute the full factorials — the (n − r)! in the denominator cancels everything below n−r+1.

**Why is nCr smaller than nPr?**
Combinations ignore order, so several permutations collapse into one combination. Specifically, each unordered group of r items can be arranged in r! ways, so nCr = nPr / r!. With n = 5, r = 2 there are 20 ordered pairs but only 10 unordered pairs because each pair (like A,B and B,A) is counted once.

**What is 0! and why does it equal 1?**
By definition 0! = 1. This keeps the formulas consistent: there is exactly one way to arrange zero items (the empty arrangement), and it makes nC0 = 1 and nCn = 1 work out correctly. So nP0 = n!/n! = 1 and nCn = n!/(n!·0!) = 1.

**Can n or r be negative or a decimal?**
No. Permutations and combinations are only defined for non-negative whole numbers with n ≥ r ≥ 0. Negative values, decimals, or r larger than n have no combinatorial meaning, so this calculator flags them as invalid rather than returning a misleading number.

**What are some real-world examples of each?**
Permutations: PINs and passwords, race podium finishes, seating arrangements, and ranking choices — anything where the order of the selected items distinguishes one outcome from another. Combinations: lottery number sets, 5-card poker hands, picking a committee, or choosing pizza toppings — where only which items are chosen matters, not their order.


## Sources

- [Wikipedia — Permutation](https://en.wikipedia.org/wiki/Permutation)
- [Wikipedia — Combination](https://en.wikipedia.org/wiki/Combination)
- [Wolfram MathWorld — Binomial Coefficient](https://mathworld.wolfram.com/BinomialCoefficient.html)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Permutation and Combination Calculator", https://hifreetools.com/calculators/permutation-combination-calculator
