How to use the binomial distribution calculator
- Enter the number of trials n and the probability of success on each trial p, as a decimal, a percent or a fraction.
- Choose what you want: exactly x successes, at most x, fewer than x, at least x, more than x, or between x₁ and x₂.
- Enter x. The probability, the other probabilities for the same x, the mean and standard deviation, the chart and the table update as you type.
What the binomial distribution is
The NIST/SEMATECH e-Handbook of Statistical Methods puts it simply: “The binomial distribution is used when there are exactly two mutually exclusive outcomes of a trial. These outcomes are appropriately labeled ‘success’ and ‘failure’.” The random variable X counts the successes in n trials.
OpenStax lists three characteristics of a binomial experiment: “There are a fixed number of trials,” there are “only two possible outcomes, called ‘success’ and ‘failure,’ for each trial,” and “the n trials are independent and are repeated using identical conditions.” So the probability of success, p, stays the same from trial to trial, and the probability of failure is q = 1 − p. Flipping a coin 10 times, guessing on 20 true-or-false questions, or checking 50 parts from a production line where each is defective with the same probability are all binomial.
The binomial formula
The probability of exactly x successes is P(X = x) = C(n, x) × pˣ × qⁿ⁻ˣ, where C(n, x) = n! / (x!(n − x)!) is the number of ways to choose which x of the n trials are the successes. Each such arrangement has probability pˣqⁿ⁻ˣ, and there are C(n, x) of them.
For example, with n = 20 and p = 0.41, the probability of exactly 12 successes uses C(20, 12) = 125,970 arrangements, each with probability 0.41¹² × 0.59⁸, so P(X = 12) = 0.041734. Twelve successes is quite possible, but it is well above the mean of np = 8.2.
At most, at least and the other cumulative probabilities
Most real questions ask about a range: at most 12, at least 3, fewer than 5. These add up the single probabilities. “At most x” is P(X ≤ x) = P(X = 0) + P(X = 1) + … + P(X = x), the cumulative probability. The others follow from it:
- Fewer than x: P(X < x) = P(X ≤ x − 1).
- At least x: P(X ≥ x) = 1 − P(X ≤ x − 1).
- More than x: P(X > x) = 1 − P(X ≤ x).
- Between x₁ and x₂, inclusive: P(x₁ ≤ X ≤ x₂) = P(X ≤ x₂) − P(X ≤ x₁ − 1).
The calculator shows all five single-x probabilities at once, so you don’t have to work out which one a word problem means before you start.
Worked examples
In OpenStax’s Example 4.13, about 41% of adult workers have a high school diploma but don’t pursue further education. If 20 workers are chosen at random, the probability that at most 12 of them are in that group is P(X ≤ 12) = 0.973785, which matches OpenStax’s 0.9738. You would expect np = 20 × 0.41 = 8.2 of them.
In Example 4.14, a catalog has 560 pages, 8 of which feature signature artists, and 100 pages are sampled. Entering p as the fraction 8/560, the probability that more than three sampled pages feature signature artists is P(X > 3) = 0.055681, which OpenStax rounds to 0.0557.
In Example 4.15, the lifetime risk of developing cancer is about 1.5%, and 200 people are sampled. The mean is 3, the standard deviation is 1.71901, and P(X ≤ 8) = 0.996496. Is it more likely that five or six people develop cancer? P(X = 5) = 0.101067 and P(X = 6) = 0.0500206, so five is about twice as likely as six.
Mean, standard deviation and the most likely value
For the binomial distribution, OpenStax gives the mean and variance as “μ = np and σ² = npq,” so the standard deviation is σ = √(npq). The mean is the long-run average number of successes, and σ measures how far a typical result falls from it. NIST gives the mode, the most likely number of successes, as the whole number between p(n + 1) − 1 and p(n + 1). When p(n + 1) is a whole number, p(n + 1) − 1 and p(n + 1) are equally likely, and the calculator shows both.
The shape of the distribution
When p = 0.5 the distribution is symmetric about n/2. When p is small, it is bunched near 0 with a long tail to the right, and when p is close to 1 it is bunched near n. As n grows, the bars form the familiar bell shape around np. The chart above shows the part of the distribution where nearly all of the probability lies, with the bars for your question highlighted.
When it isn’t binomial
The independence condition is the one most often broken. OpenStax’s Example 4.16 chooses a chairperson and a recorder from a committee of ten staff members and six students by drawing names without replacement. The chance that the second name is a student depends on the first, so the trials aren’t independent and the problem isn’t binomial. Drawing without replacement from a small group calls for the hypergeometric distribution instead.
In Excel, Google Sheets or R
Excel’s BINOM.DIST(number_s, trials, probability_s, cumulative) gives either probability. In Microsoft’s words, “If cumulative is TRUE, then BINOM.DIST returns the cumulative distribution function, which is the probability that there are at most number_s successes; if FALSE, it returns the probability mass function.” BINOM.DIST.RANGE(trials, probability_s, number_s, number_s2) gives the probability of a range of successes directly. In R, dbinom gives P(X = x) and pbinom gives P(X ≤ x). The calculator writes the exact formula for your question in both.
Accuracy for large n
Adding up thousands of tiny probabilities, or using a normal approximation, can lose accuracy for large n or far out in the tails. The calculator instead works out each single probability with Loader’s saddle-point method and each cumulative probability from the incomplete beta function, so results stay accurate for up to a billion trials. Results are kept as logarithms as well, so probabilities far smaller than 10⁻³⁰⁰ are shown in powers of ten instead of being rounded to 0.
Your data stays on your device
Everything is worked out in your browser. Nothing you type is sent anywhere or stored.
Frequently asked questions
What is the difference between “at most” and “fewer than”?
“At most 12” includes 12: P(X ≤ 12). “Fewer than 12” stops at 11: P(X < 12) = P(X ≤ 11). In the same way, “at least 3” includes 3, while “more than 3” starts at 4.
Can I enter p as a percent or a fraction?
Yes. Type 0.41, 41% or a fraction such as 8/560. The calculator uses the exact value of the fraction.
How large can n be?
Up to a billion trials. The probabilities are worked out exactly, not with a normal approximation, so they stay accurate even far out in the tails.
When is a problem not binomial?
When the number of trials isn’t fixed, when there are more than two outcomes, or when the trials aren’t independent, such as drawing without replacement from a small group. Then another distribution, such as the hypergeometric, fits better.
How do I do this in Excel or Google Sheets?
BINOM.DIST(x, n, p, FALSE) gives P(X = x), and BINOM.DIST(x, n, p, TRUE) gives P(X ≤ x). The calculator shows the exact formula for your question under the result.
Is my data uploaded?
No. Everything is worked out in your browser and nothing you type is sent anywhere or stored.