Permutation & Combination Calculator (nPr, nCr, Factorial)

Calculate permutations (nPr), combinations (nCr) and factorials, with or without repetition, using exact big-number arithmetic.

Updated · Free · Runs in your browser

Repetition allowed?
Combinations (order doesn't matter) —
Permutations (order matters) —
Factorial —
Odds —
Formula —
Size of the answer —
    Was this calculator helpful?

    The formula

    Factorial: n! = n × (n − 1) × … × 2 × 1, with 0! = 1
    Permutations (order matters): nPr = n! ÷ (n − r)!
    Combinations (order doesn't matter): nCr = n! ÷ (r!(n − r)!)
    With repetition: permutations = nʳ; combinations = (n + r − 1)! ÷ (r!(n − 1)!)

    Worked example

    1. Choosing 3 from 10 people:
    2. Permutations, for gold, silver and bronze: 10 × 9 × 8 = 720.
    3. Combinations, for a committee of three: 720 ÷ 3! = 720 ÷ 6 = 120.
    4. With repetition (3-digit codes from 10 digits): 10³ = 1,000 permutations.

    Permutations vs combinations

    Both count the ways to choose r items from a set of n, but they differ on whether order matters. In a permutation, order matters: choosing Alice, Ben and Chloe for gold, silver and bronze is different from choosing Chloe, Ben and Alice. In a combination, order doesn't matter: a committee of Alice, Ben and Chloe is the same committee whatever order you pick them in. Since each group of r items can be arranged in r! orders, there are always r! times as many permutations as combinations.

    Factorials

    The factorial n! is the number of ways to arrange n different items in a row: n choices for the first position, n − 1 for the second and so on. So 5! = 120, and a deck of 52 cards can be shuffled into 52! ≈ 8.07 × 10^67 orders, so many that every properly shuffled deck has almost certainly never existed before. By definition 0! = 1, since there's exactly one way to arrange nothing. Factorials grow faster than exponential functions, so the calculator uses exact big-integer arithmetic for large answers.

    Counting with repetition

    When items can be chosen more than once, the formulas change. A 4-digit PIN allows repeated digits and order matters, so there are 10⁴ = 10,000 possibilities. Combinations with repetition count selections like choosing 3 scoops from 10 ice cream flavours, where you can pick the same flavour twice: (10 + 3 − 1)! ÷ (3! × 9!) = 220. This "stars and bars" formula is used throughout probability and statistics. Choose "repetition allowed" to use these versions.

    Lotteries and card games

    Combinations answer most lottery and card questions, since the order of drawing doesn't matter. A 6-from-49 lottery has 49C6 = 13,983,816 possible tickets, so a single ticket has odds of 1 in nearly 14 million. There are 52C5 = 2,598,960 possible five-card poker hands, and exactly 4 of them are royal flushes. Our lottery odds calculator works out the odds for every prize tier of games with a bonus ball, such as Powerball and EuroMillions.

    Passwords and security

    Permutations with repetition also measure password strength. A password of 8 characters chosen from 94 printable characters has 94⁸ ≈ 6.1 × 10^15 possibilities; each extra character multiplies that by 94. Security experts usually express this as entropy in bits: log₂(94⁸) ≈ 52 bits. Our password entropy calculator estimates how long it would take to crack a password by brute force, and the UUID collision calculator uses similar counting to estimate the chance of duplicate IDs.

    Pascal's triangle

    Combinations also appear in Pascal's triangle: the r-th entry in row n is nCr, and each entry is the sum of the two above it. This gives the identity nCr = (n−1)C(r−1) + (n−1)Cr and explains why the coefficients of (a + b)ⁿ are combinations, known as the binomial theorem.

    Tips for exam questions

    Read the question carefully to decide whether order matters. Words such as "arrange", "order", "rank", "line up" or positions such as first and second suggest permutations; "choose", "select", "group", "team" or "hand" suggest combinations. Check whether repetition is allowed. For more complex questions, multiply the counts of independent choices, such as 5 starters × 8 mains × 4 desserts = 160 meals, and subtract arrangements that break a rule. The scientific calculator also supports the ! symbol for quick factorials.

    Frequently asked questions

    What is the difference between a permutation and a combination?
    In a permutation the order of selection matters; in a combination it doesn't. There are r! permutations for every combination.
    What is 10 choose 3?
    10C3 = 10! ÷ (3! × 7!) = 120.
    Why is 0! equal to 1?
    There's exactly one way to arrange zero items. Defining 0! = 1 also makes the formulas for permutations and combinations work when r = 0 or r = n.
    How many 4-digit combinations are there from 0–9?
    If digits can repeat and order matters, as with a PIN or combination lock, there are 10⁴ = 10,000. Without repeats, there are 10 × 9 × 8 × 7 = 5,040.
    How many poker hands are there?
    There are 52C5 = 2,598,960 different five-card hands from a standard deck.

    ↑↓ to navigate · Enter to open