Combinations & Permutations Calculator

Calculate exact combinations (nCr) and permutations (nPr) when choosing r items from n without repetition. Copy or save the complete result as TXT or JSON.

How to use

  1. Choose combinations when order does not matter, or permutations when it does.
  2. Enter the total n and selected count r, then calculate.
  3. Review the exact integer result and input conditions before copying.

Calculation inputs

Enter plain nonnegative integers. n and r: 0–10,000; r must not exceed n. Each input: at most 32 characters. Signs, spaces, decimals, exponents and commas are not supported.

Calculations are without repetition. Result limit: 10,000 digits. TXT and JSON: 11,000 bytes each. Inputs and results are neither stored nor sent.

Results

Try a use case and check the result

Choose two out of five distinct items and compare whether order matters.

Example buttons replace the inputs and settings above and calculate. Restore previous input steps back one example at a time. After trying multiple examples, repeat restore to return to your original input. This history is lost when the page closes.

Choose an unordered pair from five people

Input and settings

Operation: combination / n=5 / r=2

Expected result

C(5, 2) = 10

Choose first and second place from five people

Input and settings

Operation: permutation / n=5 / r=2

Expected result

P(5, 2) = 20

How to read the result

Combinations count A/B and B/A as the same pair. Ordered places distinguish them, giving 5×4=20 permutations. Dividing by 2! gives ten combinations. Items are selected without repetition. The output is a count and makes no assumption that outcomes are equally likely.

Scope and limits

Use whole numbers with 0≤r≤n≤10,000, at most 32 characters per field; signs, spaces, decimals and exponents are rejected. Sampling with replacement and indistinguishable-item counting are unsupported. r=0 returns one. BigInt keeps integers exact, with a 10,000-digit result limit and 11,000-byte output limit.

Verification: existing functions check ten versus twenty, r=0 and r=n, rejection of r>n and exact large integers. Browser checks compare real Worker results, saved JSON mode/no-repetition flags and two-step restoration.

Continue with the next task

Details and limits

A combination nCr counts selections of r distinct items from n when order does not matter. A permutation nPr also distinguishes the order of the selected items. Neither calculation allows selecting the same item more than once.

Choosing 2 items from 5 gives 10 combinations or 20 permutations. The example button uses 52 items and chooses 5, giving 2,598,960 combinations.

The formulas are nCr = n! / (r! × (n−r)!) and nPr = n! / (n−r)!. With 0! = 1, r = 0 gives 1 in either mode. When n = r, the combination is 1 and the permutation is n!.

Leading zeros are allowed. JSON contains normalized n and r as strings, and the exact result as a string, avoiding floating-point rounding. Combinations use the smaller of r and n−r to reduce the calculation steps.

Results exceeding 10,000 digits produce an error; partial results cannot be copied or saved. TXT includes the mode, n, r and result. JSON contains operation, n, r, result and repetition:false. Files are UTF-8 without a BOM or added trailing newline.

Editing inputs or changing the mode cancels work and clears the previous result. Cancel keeps inputs. Reset clears inputs and results, keeping the mode. This tool does not calculate probabilities or selections with repetition.

Frequently asked questions

How do combinations and permutations differ?

Combinations ignore order; permutations distinguish it. A,B and B,A are one combination but two permutations.

How many ways are there to choose zero items?

There is one empty selection. Both modes return 1 when r = 0, including n = 0 and r = 0.

Can I save a large result without rounding?

Yes. Copy and save include the complete result up to 10,000 digits. Above that limit, the tool reports an error instead of truncating the result.

Related tools

Inputs and storage

Keep any content you need before clearing. This tool does not autosave inputs or results. Reloading or closing the page, clearing inputs or resetting may discard your work.

Favorites and language preferences are stored separately and may be lost when site data is cleared. Tool resets and site-data deletion do not delete files already downloaded to your device.

Explore tools & games

All 120 tools · 16 games

All 120 tools · 16 games

Text & writing 26

Calculators & converters 22

Date & time 12

Images & PDF 26

Data & web 28

Random & handy 6

Games 16