Permutation & Combination Calculator

Enter n and r to get permutations (nPr), combinations (nCr), permutations and combinations with repetition, and n! all at once — with the working shown step by step.

Number of distinct items (0–1000)

How many you pick or arrange (0–1000)

What to calculate

—

Exact value

—
Digits
—
Scientific notation
—

Step-by-step solution

    iPhone app · Free to downloadScanner - Scan to PDF, DocsScan paper documents into clean PDFs with your iPhone.View on the App Store

    About the Permutation & Combination Calculator

    This permutation and combination calculator counts the number of ways to choose or arrange items, the core of combinatorics and probability. All five results appear together; tap one to see the formula, the numbers substituted in and every simplification step.

    It uses exact integer arithmetic (BigInt), so even huge values such as 100! — a 158-digit number — are shown with every digit, alongside scientific notation (9.3326 × 10¹⁵⁷).

    How to use

    1. Enter n, the total number of distinct items, and r, how many you choose or arrange.
    2. Permutations, combinations, both “with repetition” variants and the factorial appear instantly.
    3. Tap a result to see its exact value, digit count, scientific notation and the step-by-step solution.
    4. Use “Copy value” to copy every digit of a large result.

    Worked examples

    Pizza toppings: 3 out of 12

    Input
    n = 12, r = 3 → Combinations
    Result
    C(12, 3) = 220
    (12 × 11 × 10) / (3 × 2 × 1) = 1,320 / 6 = 220

    Pepperoni-mushroom-onion is the same pizza as onion-mushroom-pepperoni, so order doesn’t matter. If double toppings were allowed, you would use combinations with repetition: 364.

    Gold, silver and bronze among 8 finalists

    Input
    n = 8, r = 3 → Permutations
    Result
    P(8, 3) = 336
    8 × 7 × 6 = 336

    Here the order is the whole point: A-B-C and B-A-C are different podiums. The number of possible medal groups without ranking is C(8, 3) = 56.

    A dozen donuts from 6 flavors

    Input
    n = 6 flavors, r = 12 donuts → Combinations with repetition
    Result
    C(6+12−1, 12) = 6,188
    = C(17, 12) = C(17, 5) = 742,560 / 120

    r is larger than n, which is fine here because flavors repeat. Plain permutations and combinations show 0 for this input, because you can’t pick 12 different flavors from 6.

    Permutation and combination formulas

    TypeNotationFormulaExample (n=5, r=2)
    PermutationsP(n, r), nPrn! / (n−r)!5 × 4 = 20
    CombinationsC(n, r), nCr, “n choose r”n! / (r!(n−r)!)20 / 2 = 10
    Permutations with repetitionnʳnʳ5² = 25
    Combinations with repetitionC(n+r−1, r)(n+r−1)! / (r!(n−1)!)C(6, 2) = 15
    Factorialn!n × (n−1) × … × 15! = 120

    Permutation or combination?

    Ask whether order matters. Electing a president and a vice-president from 10 people is a permutation (P(10, 2) = 90) because the roles differ; picking a 2-person committee is a combination (C(10, 2) = 45).

    If an item can be used more than once, you need the “with repetition” version: a 4-digit code using only the digits 1–3 has 3⁴ = 81 possibilities, and buying 2 pieces of fruit from apples, pears and oranges (two of the same allowed) gives C(4, 2) = 6 options.

    Useful values

    • Poker hands (5 cards from 52): C(52, 5) = 2,598,960
    • Powerball white balls: C(69, 5) = 11,238,513
    • 10! = 3,628,800; 20! = 2,432,902,008,176,640,000
    • 0! = 1, C(n, 0) = C(n, n) = 1, C(n, r) = C(n, n − r)

    FAQ

    What happens if r is bigger than n?

    For permutations and combinations without repetition you need r different items, so the answer is 0. With repetition, r can be larger than n.

    Why is 0! equal to 1?

    There is exactly one way to arrange zero items (do nothing), and the rule n! = n × (n − 1)! only works for n = 1 if 0! = 1. That is also why C(n, 0) = C(n, n) = 1.

    How large can the numbers be?

    n and r can each go up to 1000. 1000! has 2,568 digits, and the calculator gives every one of them exactly.

    Why is the number of combinations with repetition C(n + r − 1, r)?

    Line up r stars (the chosen items) and n − 1 bars (dividers between the n types). Every arrangement is one selection, and you only need to choose which r of the n + r − 1 positions are stars.

    How do I turn the count into a probability?

    Divide the number of favorable outcomes by the total. The chance that a random 4-digit PIN is 1234 is 1 in 10⁴ = 1 in 10,000; the chance of being dealt one specific 5-card poker hand is 1 in C(52, 5) = 2,598,960. To simulate draws instead, try the random number generator.