Binomial Distribution Calculator

Enter the number of trials, the probability of success on each trial, and the number of successes you are interested in. The calculator returns the exact binomial probability P(X = k), every cumulative probability around k, and the mean and standard deviation of the distribution.

#math#probability#binomial#statistics#distribution

A positive integer. Each trial is independent and has the same success probability.

A decimal between 0 and 1. For example, 0.5 for a fair coin or 0.1667 for a single die face.

A non-negative integer no larger than n.

P(X = 5)

0.246094

P(X ≤ 5)
0.623047
P(X ≥ 5)
0.623047
P(X < 5)
0.376953
P(X > 5)
0.376953
Mean (np)
5
Variance (np(1−p))
2.5
Standard deviation
1.581139

For n = 10 independent trials with success probability p = 0.5, the probability of exactly 5 successes is 0.246094. The expected number of successes is np = 5.

How to use this calculator

Enter three numbers. The number of trials n is a positive integer — how many independent Bernoulli experiments you are running. The probability of success p is a decimal between 0 and 1; for a fair coin it is 0.5, for a single fair die rolling a six it is 1/6 ≈ 0.1667, and for a 25% chance event it is 0.25. The number of successes k is the count you want a probability for, anywhere from 0 up to n. The headline result is P(X = k), the exact chance of getting that many successes; the breakdown shows the four cumulative probabilities (≤, ≥, <, >) and the distribution’s mean, variance and standard deviation.

How the calculation works

The binomial distribution describes the number of successes X in n independent trials, each succeeding with probability p. Its probability mass function is P(X = k) = C(n, k) · pᵏ · (1 − p)ⁿ⁻ᵏ, where C(n, k) = n! / (k! (n − k)!) is the binomial coefficient — the number of distinct ways to pick which k of the n trials succeed. The mean (expected number of successes) is np, the variance is np(1 − p), and the standard deviation is √(np(1 − p)). The calculator computes the entire PMF using a numerically stable ratio recurrence in log-space, which works reliably even for n in the thousands without overflow.

Worked example

Flip a fair coin ten times: n = 10, p = 0.5, and you want the probability of exactly five heads (k = 5). The binomial coefficient C(10, 5) = 252, and 0.5⁵ · 0.5⁵ = 1/1024, so P(X = 5) = 252 / 1024 = 63/256 ≈ 0.2461. The cumulative probability P(X ≤ 5) is about 0.6230 by symmetry, the mean is np = 5, the variance is 2.5 and the standard deviation is √2.5 ≈ 1.5811 — matching every standard textbook table for the Binomial(10, 0.5) distribution.

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 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 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. This 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.

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.