Exact integers, n up to 1,000Reviewed 28 Sep 2026Runs in your browser

Permutation & Combination Calculator (nPr and nCr)

Count arrangements (order matters) and selections (order does not) — with or without repetition. Results are exact integers, however large, with the factorial cancellation shown step by step.

Who wrote it

Written by Suhaib Hassan. The counting formulas are standard and each example is re-derived by hand. Our methodology.

How the engine works

It uses arbitrary-precision integer arithmetic, multiplying only the factors that do not cancel, so no rounding or overflow occurs even when n is in the hundreds.

Why we built it

Picking the wrong formula is the usual mistake. A decision guide and a side-by-side count of all four cases help you choose correctly.

What do you want to count?

—

Presets
0 to 1,000
0 to n
Formula in use—
C(52, 5)—
—

—

Chance of one specific selection—
Number of digits—
Count for n and rFormulaResult
n!
—

Numerator

r!
—

Orderings of r items

(n − r)!
—

Cancelled factors

Permutation vs combination: does order matter?

A permutation counts each different ordering separately. A combination treats orderings of the same items as one selection, so every combination corresponds to r! permutations.

Permutations order matters

Three tokens A, B, C can be arranged in 3! = 6 different orders:

ABC · ACB · BAC · BCA · CAB · CBA

Each ordered arrangement is a separate outcome — like the gold, silver and bronze places in a race.

Combinations order does not matter

All six orders contain the same three tokens, so they collapse into a single combination:

{ A, B, C } — 1 combination

C(n, r) = P(n, r) ÷ r! — like choosing a committee, where only membership counts.

Step-by-step working

—

—

    The four counting formulas

    Combinations no repetition

    C(n, r) = n! ÷ (r!(n − r)!)

    Unordered selections where each element can be picked at most once.

    Permutations no repetition

    P(n, r) = n! ÷ (n − r)!

    Ordered arrangements without reuse: n choices, then n − 1, and so on.

    Combinations with repetition

    C(n + r − 1, r)

    Multisets of size r from n types (the “stars and bars” count), where items may repeat and order is ignored.

    Permutations with repetition

    nʳ

    Ordered sequences where each of the r positions can independently be any of the n symbols.

    When does order matter?

    A quick guide to choosing the right formula. All counts are exact.

    ScenarioOrder matters?FormulaSetupExact result
    Locker padlock, distinct numbersYesP(n, r)3 different numbers from 0–3959,280
    Lottery, pick 6NoC(n, r)6 from 4913,983,816
    Race podiumYesP(n, r)Top 3 of 8 sprinters336
    Pizza toppingsNoC(n, r)3 toppings from 10120
    Password, characters may repeatYesnʳ62 characters, 8 slots218,340,105,584,896

    Worked examples

    Password key space

    An 8-character password from 26 lowercase + 26 uppercase + 10 digits (62 symbols), repetition allowed.

    62⁸ = 218,340,105,584,896
    log₂ = 8 × 5.954 ≈ 47.6 bits

    Choosing a trial group

    Select 20 participants from a pool of 100, order irrelevant.

    C(100, 20) = 535,983,370,403,809,682,970
    ≈ 5.36 × 10²⁰ possible groups

    Mesh network links

    How many point-to-point links join 24 servers so that every pair is connected?

    C(24, 2) = 24 × 23 ÷ 2 = 276 links

    What are permutations and combinations?

    Permutations and combinations count the ways to select items from a set. A permutation is an ordered arrangement; a combination is an unordered selection. The factorial n! = n × (n − 1) × … × 1 underlies both, with 0! defined as 1.

    How to choose the formula

    • Does the order of the chosen items create a different outcome? If yes, use permutations; if no, use combinations.
    • Can the same item be chosen more than once? If yes, use the “with repetition” formulas.

    By Suhaib Hassan · Reviewed 28 September 2026 · How CalculatePilot verifies formulas →

    Sources

    • NIST Digital Library of Mathematical Functions, section 26.3 (Lattice paths: binomial coefficients) and chapter 26, Combinatorial Analysis.
    • Knuth, D. E. (1997). The Art of Computer Programming, Volume 1: Fundamental Algorithms, 3rd ed. Addison-Wesley.
    • ISO 80000-2:2019, Quantities and units — Part 2: Mathematics (notation for factorials and binomial coefficients).

    Frequently asked questions

    What is the difference between a permutation and a combination?

    A permutation counts ordered arrangements, so (1, 2, 3) and (3, 2, 1) are different. A combination counts unordered selections, so they are the same. Because each combination of size r can be arranged in r! ways, the number of permutations is always r! times the number of combinations.

    Why is a “combination lock” really a permutation lock?

    Because the order in which you enter the digits matters: 1-2-3 opens it but 3-2-1 does not. Strictly it is a count of ordered sequences, so it uses permutation formulas (with repetition if digits can be reused).

    How does this calculator handle very large factorials?

    It uses arbitrary-precision integer arithmetic, so results are exact rather than rounded to floating-point. Numbers with more than 18 digits are shown in scientific notation, and “Copy exact value” copies every digit.

    What are “stars and bars”?

    It is a method for counting combinations with repetition. Choosing r items from n types, with repeats allowed and order ignored, is equivalent to placing r stars and n − 1 bars in a row, which gives C(n + r − 1, r).

    What is 0! and what if r = 0?

    By definition 0! = 1. Choosing zero items can be done in exactly one way, so C(n, 0) = P(n, 0) = 1, and n⁰ = 1.

    Why can r not exceed n without repetition?

    You cannot pick more distinct items than exist, so the count is 0. The calculator asks you to enter r ≤ n for the no-repetition formulas; with repetition allowed, r may be larger than n.

    Related calculators

    Continue with probability and factorials.

    All Math Calculators

    Embed This Permutation & Combination Calculator

    Free and responsive, and it runs in the visitor's browser. Branding removal from $7.99/month.

    <iframe src="https://www.calculatepilot.com/embed/permutation-combination-calculator.html" width="100%" height="560" loading="lazy" title="Permutation and Combination Calculator"></iframe>
    For website owners

    Want this calculator on your own website?

    Embed it in one line of code. Keep it free with a small CalculatePilot attribution link, or go white-label: your brand, no attribution, one license for all your domains.

    • All 159 calculators, unlimited embeds
    • Works on WordPress, Webflow, Squarespace, Wix and plain HTML
    • Runs in your visitor's browser, so nothing is sent to a server
    • License key emailed automatically after checkout, cancel anytime
    $7.99 / month
    or $89.99 / year · white-label Pro
    Get the white-label license Embed free with attribution