Binomial Distribution Calculator Explained: Formula, PMF, CDF and When to Use It

The binomial distribution counts successes in a fixed number of independent yes-or-no trials at a constant success probability. This guide derives the PMF, walks through a worked coin-flip example, lists the four conditions that have to hold for the binomial to apply, and shows how the normal and Poisson approximations relate to the exact distribution.

#math#probability#binomial#statistics#distribution#pmf#cdf

What is the binomial distribution?

The binomial distribution is the bedrock probability model for counting successes in a fixed number of repeated, independent yes-or-no trials. If you flip a coin ten times, shoot twenty free throws at a steady skill level, or sample one hundred widgets off a production line and grade each one as defective or fine, the count of successes follows a binomial distribution — provided each trial is independent of the others and the success probability does not drift between them.

The binomial distribution calculator on this page takes three inputs — the number of trials n, the success probability p, and a number of successes k — and returns the exact probability P(X = k) along with every cumulative variant around k, the mean np, the variance np(1 − p), and the standard deviation. The rest of this guide explains the formula, walks through a worked coin-flip example, lists the four conditions that have to hold for the binomial to apply, and shows where it breaks down (and what to reach for instead). The maths is school-level. The traps are subtle.

How binomial probability is calculated

For a random variable X counting successes in n independent trials with success probability p, the probability mass function is:

P(X = k) = C(n, k) · p^k · (1 − p)^(n − k)

Three pieces matter. p^k is the chance of the k successes you want, all happening. (1 − p)^(n − k) is the chance of the (n − k) failures you also need, all happening. And C(n, k) = n! / (k! (n − k)!) is the binomial coefficient — the number of distinct orderings in which k successes can be interleaved with n − k failures. You multiply the three together because the trials are independent and any of the C(n, k) orderings counts. That last factor is why the distribution exists at all; without it you would be computing the probability of one specific success pattern, not the probability of the count.

The mean (expected number of successes) is np. The variance is np(1 − p). The standard deviation is √(np(1 − p)). The mean is intuitive — if a coin lands heads half the time and you flip it ten times, you expect five heads. The variance formula falls out of the fact that X is the sum of n independent indicator variables, each contributing p(1 − p) to the variance, and independence lets you add variances. The standard deviation peaks at p = 0.5, which is why fair coins are the noisiest trial of all.

A worked example: ten fair coin flips

Plug n = 10, p = 0.5, k = 5 into the binomial distribution calculator and you get P(X = 5) ≈ 0.2461. Here is where that number comes from by hand.

The binomial coefficient C(10, 5) is 252 — there are 252 distinct ways to choose which five of the ten flips land heads. The probability of any specific arrangement of five heads and five tails is 0.5^5 × 0.5^5 = 1/1024. Multiply: 252 / 1024 = 63/256 ≈ 0.2461. That is the single most likely outcome, but only by a hair — the probability of exactly four heads is also around 0.2051, and exactly six is the same by symmetry. The PMF is bell-shaped and clusters tightly around the mean.

The cumulative probabilities sit either side. P(X ≤ 5) is about 0.6230, P(X ≥ 5) is also about 0.6230 (the overlap at X = 5 is why the two sum to more than one), P(X < 5) is about 0.3770, and P(X > 5) the same by symmetry. The mean is np = 5, the variance 2.5, the standard deviation √2.5 ≈ 1.5811. These match every textbook table for Binomial(10, 0.5) to the last decimal.

Push the numbers further to see how the distribution behaves. At n = 10, p = 0.9, the mean is 9 and getting exactly 9 successes has probability ≈ 0.3874 — the distribution is now skewed hard against zero. At n = 100, p = 0.5, the standard deviation is 5 and roughly 95% of outcomes fall between 40 and 60 successes, which is the central-limit-theorem foreshadowing of the normal approximation discussed below.

When the binomial distribution applies

Four conditions must hold. Miss any one and the binomial gives the wrong answer — sometimes catastrophically.

1. Fixed number of trials

n has to be decided in advance, not stop-when-something-happens. Ten coin flips is binomial. Flip until you get a head, count the tails is not — that is a geometric distribution. The difference matters because the sample size of a binomial experiment is a constant, whereas the sample size of a sequential experiment is itself random. If your data was collected by "run until X" rather than "run exactly N times", the binomial PMF is the wrong tool and every probability you compute from it will be biased.

2. Independent trials

Each trial's outcome must not affect any other. Flipping the same coin again and again satisfies this; sampling without replacement from a finite urn does not. If you draw five balls without replacement from a bag of twenty, the probability of drawing a red ball changes after every draw, so the count of reds follows the hypergeometric distribution, not the binomial. The binomial is the with-replacement approximation, and it is fine when the population is large relative to the sample (a common rule of thumb: sample less than 10% of the population). For small populations, use the hypergeometric.

3. Constant success probability

p has to stay the same across all n trials. A free throw shooter whose accuracy varies game-to-game does not satisfy this — neither does a manufacturing line whose defect rate drifts with operator fatigue. When p varies by trial, the right model is the Poisson binomial distribution, which sums n independent Bernoulli variables with different success probabilities. It has no closed-form PMF, but its mean is the sum of the pᵢ and its variance is the sum of pᵢ(1 − pᵢ).

4. Binary outcomes

Each trial must have exactly two outcomes labelled success and failure. If a survey question has five options and you want to count how often each one is picked, the count vector follows a multinomial distribution, not a binomial. The binomial collapses the outcome space to a single yes/no, which is sometimes a useful simplification ("any option except A" becomes the failure category) and sometimes a destructive loss of information.

PMF, CDF, and which probability you actually want

The calculator returns five probabilities for the value of k you enter: P(X = k), P(X ≤ k), P(X ≥ k), P(X < k), and P(X > k). They answer different questions and confusing them is the most common mistake in applied binomial work.

Use P(X = k) when you genuinely care about exactly that count. "What is the chance of getting exactly five heads in ten flips?" That is the PMF.

Use P(X ≥ k) when k is a threshold you need to clear. "What is the chance of at least seven defective widgets in a sample of one hundred?" That is a tail probability and the basis of the binomial hypothesis test — see the p-value calculator for the wider testing framework.

Use P(X ≤ k) when k is an upper bound. "The order is rejected if more than three units are defective — what is the chance of acceptance?" That is P(X ≤ 3).

The strict inequalities P(X < k) and P(X > k) matter when the boundary case should be excluded. They differ from the weak inequalities by exactly P(X = k). Sloppy interchange of strict and weak is how a one-sided test ends up reporting a p-value that is off by one PMF bar.

Normal and Poisson approximations

For large n the exact binomial can be replaced by smoother approximations that lend themselves to analytic confidence intervals and quick mental estimates.

The normal approximation says that when np ≥ 10 and n(1 − p) ≥ 10, Binomial(n, p) is well approximated by a normal distribution with the same mean np and the same variance np(1 − p). A continuity correction of ±0.5 sharpens the approximation when you convert discrete counts into continuous z-scores. The normal approximation is the basis of the Wald confidence interval for a proportion that the confidence interval calculator builds — and the reason that interval misbehaves when np or n(1 − p) is small.

The Poisson approximation applies in the opposite regime — n is large but p is small, so np stays moderate. The classic example is rare events: tickets won per day in a national lottery, typos per book page, photons hitting a detector per second. Binomial(n, p) with np = λ converges to a Poisson distribution with rate λ as n grows and p shrinks. The Poisson is a one-parameter distribution, so swapping it in cuts your model complexity in half whenever it is a fair approximation.

Common mistakes

Treating dependent trials as independent. Sampling without replacement from a small batch is the textbook trap. So is treating consecutive at-bats by the same baseball player as independent when scouts know the pitcher adapts. If the trials watch each other, the binomial overstates how concentrated the count is around the mean.

Computing P(X = k) when the question is P(X ≥ k). "Is this result surprising?" usually means "how often would a result this extreme or more happen by chance?", which is a tail probability, not a point probability. The point probability is always smaller and almost always misleading on its own.

Forgetting that p must reflect a single trial. A common slip is plugging in the overall success rate across many people when the trials are actually one person doing the test repeatedly. The two p's coincide only when there is no person-to-person variation, which is rarely true.

Using the normal approximation when np is small. Below np ≈ 10 or n(1 − p) ≈ 10 the normal approximation misses the discrete bumps in the tail and produces confidence intervals that under- or over-cover. Use the exact binomial PMF (this calculator) or a Clopper-Pearson interval instead.

How to design a binomial experiment well

  • Fix n in advance. Decide the number of trials before you see any data. Stopping early when a result "looks significant" inflates false-positive rates and breaks the binomial PMF.
  • Power the test. Before running the experiment, work out what success rate you would consider meaningfully different from the null and pick n so you can detect it. The sample size calculator handles the proportion-comparison case directly.
  • Randomise to break dependence. Shuffle the order of trials and the assignment of subjects so that hidden correlations (operator, time-of-day, batch) cannot masquerade as a real effect.
  • Pre-register the test statistic. Decide in advance whether you are looking at P(X ≥ k) (one-sided), |X − np| (two-sided), or some other functional of the count. Choosing after the fact is how p-hacking happens.
  • Report the count, not just the proportion. "7 out of 20" tells a reader exactly how much information was in the experiment; "35%" tells them nothing about whether n was 20 or 20,000. Confidence intervals around the proportion shrink with √n — the count makes that visible.

Where the binomial shows up in practice

Quality control is the original application. A sample of n units is drawn from a production lot, each is graded pass or fail, and the lot is accepted if the defect count stays under a threshold. The acceptance probability is a binomial tail, the operating-characteristic curve is the binomial CDF as a function of p, and the sampling plan choosing n and the threshold is a textbook Bayesian decision problem with a binomial likelihood.

Clinical trials use the binomial to model the count of patients who respond to a treatment in an arm of size n. The null hypothesis (response rate equals the historical rate p₀) defines a binomial distribution, the observed count is compared against its tail, and the p-value comes out the other end. The same machinery powers A/B testing in software — clicks, conversions and signups are all binomial successes.

Genetics applies the binomial to the count of offspring with a recessive trait when both parents are heterozygous — the per-offspring probability is 1/4, the trials are independent if you assume no fitness effect, and the count over a litter is binomial. The same logic underwrites Mendelian segregation tests in teaching laboratories worldwide.

Polling, finally, uses the binomial as the simplest model for the count of respondents preferring a given candidate, with the normal approximation supplying the margin of error you see quoted on television. The margin is a confidence interval around p̂ = k/n, roughly ±1.96 × √(p̂(1 − p̂) / n), which the standard deviation calculator and confidence interval calculator compute for you on real data.

When to seek professional advice

If the binomial is being used to support a regulated decision — drug approval, financial product pricing, safety certification — the calculator is fine for back-of-envelope sanity checks but not for the filing itself. The same applies if independence is questionable, if p is uncertain rather than known, or if your decision needs a Bayesian framing that treats p itself as random. A statistician will pick the right approximation, choose the right confidence procedure (Clopper-Pearson, Wilson, Agresti-Coull) for the sample size, and document the assumptions properly.

Frequently asked questions

When can I use the binomial distribution?

When you have a fixed number of independent trials, each with the same two possible outcomes (success or failure) and the same probability of success. Coin flips, free-throw attempts at a constant skill level, defective items drawn with replacement from a large batch, and yes/no survey responses sampled independently are all classic examples. If trials are not independent or the success probability changes between trials, the binomial is the wrong model — look at the hypergeometric, negative binomial, or Poisson binomial instead.

What is the difference between P(X = k), P(X ≤ k) and P(X ≥ k)?

P(X = k) is the probability of getting exactly k successes — the bar at k on the PMF chart. P(X ≤ k) is the cumulative probability of k or fewer successes, summing the PMF from 0 up to k. P(X ≥ k) is the probability of k or more successes, equal to 1 − P(X ≤ k − 1). The binomial distribution calculator returns all four cumulative variants (≤, ≥, <, >) so you can pick the one that matches the question you are asking.

How do I compute the binomial coefficient C(n, k)?

C(n, k) = n! / (k! (n − k)!) counts the number of ways to choose k items from n without regard to order. For small n you can compute it directly: C(10, 3) = 10! / (3! × 7!) = 120. For large n the factorials overflow, so software uses an iterative product or works in log-space. The calculator never materialises C(n, k) on its own; instead it computes the PMF by the recurrence P(k + 1) / P(k) = (n − k) / (k + 1) × p / (1 − p), which is numerically stable for n in the thousands.

Why is the mean np?

Because the number of successes is the sum of n independent indicator variables — one for each trial — and each indicator has expected value p. By linearity of expectation, E[X] = n × p. The variance follows from independence: Var(X) = n × p × (1 − p). The standard deviation, √(np(1 − p)), tells you the typical spread of the count around its mean and is maximised at p = 0.5.

When does the binomial distribution approximate a normal distribution?

When n is large and p is not too close to 0 or 1 — a common rule of thumb is np ≥ 10 and n(1 − p) ≥ 10. Under those conditions, Binomial(n, p) is well approximated by the normal distribution with mean np and variance np(1 − p), which is the foundation of the normal approximation to confidence intervals for proportions. For small np or n(1 − p), use either the exact binomial (this calculator) or a Poisson approximation when p is very small and n is very large.

How is the binomial distribution different from the Bernoulli distribution?

A Bernoulli(p) random variable is a single trial — it takes the value 1 with probability p and 0 with probability 1 − p. A Binomial(n, p) random variable is the sum of n independent Bernoulli(p) variables. So Bernoulli is the n = 1 special case of binomial, and binomial is what you get when you stack Bernoullis. Most software treats them as separate distributions only for naming clarity.

Does this calculator handle large n?

Yes. The PMF is computed by an iterative ratio recurrence in log-space, so it stays numerically stable for n in the thousands and the cumulative probabilities are clamped to [0, 1] to absorb any floating-point drift. The practical limit is your browser's patience: even at n = 10,000 the full table is built in well under a second.

Related calculators

  • Binomial Distribution Calculator — the parent tool returning P(X = k), the full set of cumulative probabilities, the mean, the variance and the standard deviation for any n and p.
  • P-Value Calculator — one- and two-tailed p-values for the most common test statistics, including binomial exact tests.
  • Standard Deviation Calculator — sample and population spread for any list of numbers, including binomial samples expressed as counts.
  • Confidence Interval Calculator — normal-approximation intervals for a proportion, plus mean intervals when the sample is continuous.
  • Sample Size Calculator — pick n to detect a target difference between two proportions at a chosen significance level and power.

Frequently asked questions

When can I use the binomial distribution?

When you have a fixed number of independent trials, each with the same two possible outcomes (success or failure) and the same probability of success. Coin flips, free-throw attempts at a constant skill level, defective items drawn with replacement from a large batch, and yes/no survey responses sampled independently are all classic examples. If trials are not independent or the success probability changes between trials, the binomial is the wrong model — look at the hypergeometric, negative binomial, or Poisson binomial instead.

What is the difference between P(X = k), P(X ≤ k) and P(X ≥ k)?

P(X = k) is the probability of getting exactly k successes — the bar at k on the PMF chart. P(X ≤ k) is the cumulative probability of k or fewer successes, summing the PMF from 0 up to k. P(X ≥ k) is the probability of k or more successes, equal to 1 − P(X ≤ k − 1). The binomial distribution calculator returns all four cumulative variants (≤, ≥, <, >) so you can pick the one that matches the question you are asking.

How do I compute the binomial coefficient C(n, k)?

C(n, k) = n! / (k! (n − k)!) counts the number of ways to choose k items from n without regard to order. For small n you can compute it directly: C(10, 3) = 10! / (3! × 7!) = 120. For large n the factorials overflow, so software uses an iterative product or works in log-space. The calculator computes the PMF by the recurrence P(k + 1) / P(k) = (n − k) / (k + 1) × p / (1 − p), which is numerically stable for n in the thousands.

Why is the mean np?

Because the number of successes is the sum of n independent indicator variables — one for each trial — and each indicator has expected value p. By linearity of expectation, E[X] = n × p. The variance follows from independence: Var(X) = n × p × (1 − p). The standard deviation, √(np(1 − p)), tells you the typical spread of the count around its mean and is maximised at p = 0.5.

When does the binomial distribution approximate a normal distribution?

When n is large and p is not too close to 0 or 1 — a common rule of thumb is np ≥ 10 and n(1 − p) ≥ 10. Under those conditions, Binomial(n, p) is well approximated by the normal distribution with mean np and variance np(1 − p), which is the foundation of the normal approximation to confidence intervals for proportions.

How is the binomial distribution different from the Bernoulli distribution?

A Bernoulli(p) random variable is a single trial — it takes the value 1 with probability p and 0 with probability 1 − p. A Binomial(n, p) random variable is the sum of n independent Bernoulli(p) variables. So Bernoulli is the n = 1 special case of binomial, and binomial is what you get when you stack Bernoullis.

Does this calculator handle large n?

Yes. The PMF is computed by an iterative ratio recurrence in log-space, so it stays numerically stable for n in the thousands and the cumulative probabilities are clamped to [0, 1] to absorb any floating-point drift. The practical limit is your browser’s patience: even at n = 10,000 the full table is built in well under a second.

Informational only. Not personalised financial, legal, or tax advice.