Combination Calculator

Combinations
--

You're picking 3 toppings from a menu of 10, and you don't care about the order—pepperoni, mushrooms, and olives is the same as olives, mushrooms, and pepperoni. That's a combination problem. Or maybe you're arranging 3 books from a shelf of 10 on your nightstand, where the order matters because you want your favorite on top. That's a permutation. Our Combination & Permutation Calculator handles both scenarios instantly. Just punch in your total items (n) and how many you're choosing (k), and you'll get the exact number of possible outcomes, plus a full step-by-step breakdown of the math. No more guessing or scribbling factorials on napkins.

How to Use the Combination Calculator

Using the calculator is straightforward. Follow these steps:

  1. Choose your mode: Click either "Combinations (nCr)" or "Permutations (nPr)" at the top to select which calculation you want to perform.
  2. Enter Total Items (n): Type the total number of items in your set (for example, 10 if you have 10 toppings).
  3. Enter Items to Choose (k): Type how many items you are selecting (for example, 3 if you're picking 3 toppings).
  4. Click Calculate: Press the blue "Calculate" button. The result will appear instantly, showing the number of combinations or permutations, along with a step-by-step breakdown of the factorial math.
  5. Use Advanced Options (optional): Click "Advanced Options" to set decimal places, choose a rounding mode (standard, ceiling, or floor), or display the alternate result (e.g., show the permutation when in combination mode).
  6. Reset: Click the "Reset" button to clear all fields and start a new calculation.

The result box shows the final answer, and the breakdown section walks you through each step, making it easy to learn or verify your work.

Formula

The calculator uses two classic formulas from combinatorics. For combinations, where order doesn't matter, the formula is:

C(n, k) = n! / (k! × (n - k)!)

For permutations, where order does matter, the formula is:

P(n, k) = n! / (n - k)!

In both formulas, the exclamation mark (!) denotes the factorial operation, which multiplies a number by every positive integer less than itself. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.

Let's walk through a practical example. Suppose you have 5 books on a shelf and you want to choose 2 to take on a trip. If you don't care about which book you grab first (order doesn't matter), you'd use combinations: C(5, 2) = 5! / (2! × 3!) = 120 / (2 × 6) = 120 / 12 = 10. There are 10 different pairs you could pick. If you cared about the order you grab them (first book and second book are different), you'd use permutations: P(5, 2) = 5! / 3! = 120 / 6 = 20. The calculator does all this heavy lifting for you, even for large numbers up to n = 170, where factorials get astronomically large.

What is the Combination Calculator?

This calculator is a tool for anyone who needs to count the number of ways to select items from a set. Combinatorics—the math of counting—shows up everywhere: in probability (what are the odds of winning the lottery?), in game design (how many unique hands can you be dealt in poker?), in data science (how many feature combinations can you test?), and in everyday decision-making (how many different salads can you make from 8 ingredients?).

The core idea is simple: you have a set of n distinct items, and you want to choose k of them. If the order of selection doesn't matter, you're counting combinations. If the order does matter, you're counting permutations. This calculator handles both, and it's smart enough to show you the underlying factorial math so you can see exactly how the answer is derived. Whether you're a student studying for a statistics exam, a teacher preparing a lesson, or a hobbyist figuring out the odds of a board game, this tool saves you time and eliminates errors.

Frequently Asked Questions

What happens if k is greater than n?

If you try to choose more items than are available (k > n), the calculator will show an error message: "k cannot be greater than n." This is mathematically impossible—you can't pick 5 items from a set of 3. The calculator won't proceed until you correct the values.

Why does the step-by-step breakdown disappear for very large numbers?

When n is greater than 170, the factorial values become astronomically large—far beyond what standard JavaScript numbers can represent accurately. In those cases, the calculator still computes the correct result using efficient multiplicative algorithms, but it cannot display the full factorial breakdown without losing precision. It will show a message explaining that the values are too large to display step-by-step.

Can I use this calculator for lottery odds or poker hand probabilities?

Absolutely. Combinations are the foundation for calculating lottery odds (e.g., how many ways can you pick 6 numbers from 49?) and poker hand probabilities (e.g., how many possible 5-card hands are there from a 52-card deck?). Just enter your n and k values, and the calculator will give you the total number of possible outcomes, which you can then use to compute probabilities by dividing by the total number of equally likely outcomes.

Comments