Written and maintained by CASRAI Editorial Board
Last updated
To calculate a binomial probability, count the ways to place k successes among n trials, C(n, k), and multiply by pk(1 − p)n−k, where p is the probability of success on one trial. A web page cannot run a live calculator here, so this guide gives the formula, a lookup table for n = 10, two worked examples you can check by hand, and the matching function in Excel, R and Python.
How to calculate binomial probability
The binomial probability mass function gives the chance of exactly x successes in n trials: P(x; p, n) = C(n, x) px(1 − p)n−x, for x = 0, 1, …, n, where C(n, x) = n! / (x!(n − x)!). The mean is np, the variance is np(1 − p), and the standard deviation is the square root of the variance (NIST/SEMATECH e-Handbook of Statistical Methods, checked 2026-10-29: binomial distribution).
When the binomial model applies
NIST describes the model for trials with exactly two mutually exclusive outcomes, conventionally success and failure, where p is fixed for all trials. In a research design this fits, for example, n participants who each either respond or do not respond, provided each has the same response probability. If the number of events has no fixed number of trials, the Poisson distribution is the usual alternative.
At most, at least and exactly
Exactly k is the formula above. At most k, written P(X ≤ k), is the sum of the exact probabilities from 0 to k, which is the cumulative distribution function. At least k is 1 − P(X ≤ k − 1). The off-by-one in that last step is the most common error.
Worked example 1: exactly k successes
Suppose each of 12 invited participants completes a survey with probability 0.2. What is the probability that exactly 3 complete it?
- C(12, 3) = 220.
- p3 = 0.23 = 0.008.
- (1 − p)9 = 0.89 = 0.134217728.
- P(X = 3) = 220 × 0.008 × 0.134217728 = 0.2362 (4 decimal places).
The expected number of completions is np = 2.4, and the variance is np(1 − p) = 1.92.
Worked example 2: at least k successes
A screening step flags each of 20 samples with probability 0.3. What is the probability that 8 or more are flagged?
P(X ≥ 8) = 1 − P(X ≤ 7). Summing the exact probabilities for k = 0 to 7 gives P(X ≤ 7) = 0.7723, so P(X ≥ 8) = 1 − 0.7723 = 0.2277 (4 decimal places, computed with exact fractions from the NIST formula).
Binomial probability table (n = 10)
Each entry is computed from the NIST formula above using exact fractions and rounded to 4 decimal places. A value shown as 0.0000 is below 0.00005; a cumulative value shown as 1.0000 is within 0.00005 of 1. As a check, the entry for p = 0.50 and k = 6 is 0.2051, which matches the unrounded value 0.2050781 that Microsoft documents for BINOM.DIST(6, 10, 0.5, FALSE).
| k | p = 0.10 | p = 0.25 | p = 0.50 | |||
|---|---|---|---|---|---|---|
| P(X = k) | P(X ≤ k) | P(X = k) | P(X ≤ k) | P(X = k) | P(X ≤ k) | |
| 0 | 0.3487 | 0.3487 | 0.0563 | 0.0563 | 0.0010 | 0.0010 |
| 1 | 0.3874 | 0.7361 | 0.1877 | 0.2440 | 0.0098 | 0.0107 |
| 2 | 0.1937 | 0.9298 | 0.2816 | 0.5256 | 0.0439 | 0.0547 |
| 3 | 0.0574 | 0.9872 | 0.2503 | 0.7759 | 0.1172 | 0.1719 |
| 4 | 0.0112 | 0.9984 | 0.1460 | 0.9219 | 0.2051 | 0.3770 |
| 5 | 0.0015 | 0.9999 | 0.0584 | 0.9803 | 0.2461 | 0.6230 |
| 6 | 0.0001 | 1.0000 | 0.0162 | 0.9965 | 0.2051 | 0.8281 |
| 7 | 0.0000 | 1.0000 | 0.0031 | 0.9996 | 0.1172 | 0.9453 |
| 8 | 0.0000 | 1.0000 | 0.0004 | 1.0000 | 0.0439 | 0.9893 |
| 9 | 0.0000 | 1.0000 | 0.0000 | 1.0000 | 0.0098 | 0.9990 |
| 10 | 0.0000 | 1.0000 | 0.0000 | 1.0000 | 0.0010 | 1.0000 |
To read an at-least value from the table, use the cumulative column one row up: for p = 0.25, P(X ≥ 4) = 1 − P(X ≤ 3) = 1 − 0.7759 = 0.2241.
Calculate binomial probability in Excel, R and Python
All three tools expose the same three questions: exactly k, at most k, and more than k. The argument order differs, so check it against the documentation.
| Question | Excel | R | Python (SciPy) |
|---|---|---|---|
| Exactly k | BINOM.DIST(k, n, p, FALSE) | dbinom(k, n, p) | binom.pmf(k, n, p) |
| At most k | BINOM.DIST(k, n, p, TRUE) | pbinom(k, n, p) | binom.cdf(k, n, p) |
| More than k | 1 − BINOM.DIST(k, n, p, TRUE) | pbinom(k, n, p, lower.tail = FALSE) | binom.sf(k, n, p) |
Example 2 in code: in R, pbinom(7, 20, 0.3, lower.tail = FALSE); in Python, from scipy.stats import binom; binom.sf(7, 20, 0.3); in Excel, =1-BINOM.DIST(7,20,0.3,TRUE). Each returns 0.2277 for P(X ≥ 8).
- Off-by-one: R’s
lower.tail = FALSEreturns P[X > x], not P[X ≥ x] (R documentation, checked 2026-10-29). To get at least 8, pass 7. - Excel errors: BINOM.DIST returns #NUM! if the number of successes is below 0 or above the number of trials, or if the probability is below 0 or above 1, and #VALUE! for non-numeric arguments; successes and trials are truncated to integers (Microsoft Support, checked 2026-10-29).
- SciPy: the survival function sf equals 1 − cdf, but the documentation notes that sf is sometimes more accurate (SciPy documentation, checked 2026-10-29).
Related measures
The spread of the count is described by the standard deviation, here the square root of np(1 − p). If you observed x successes and want an interval for p rather than a probability of x, see the confidence interval for a proportion. A p-value from an exact binomial test is a tail sum of the same exact probabilities.
Frequently asked questions
How do I calculate binomial probability by hand?
Compute C(n, x), multiply by px and by (1 − p)n−x. For 12 trials, p = 0.2 and x = 3 that is 220 × 0.008 × 0.134217728 = 0.2362.
What is the difference between P(X = k) and P(X ≤ k)?
P(X = k) is the chance of exactly k successes; P(X ≤ k) adds the exact probabilities from 0 up to k. In Excel this is the cumulative argument, FALSE for exact and TRUE for at most.
How do I get “at least k”?
Subtract the cumulative probability for k − 1 from 1: P(X ≥ k) = 1 − P(X ≤ k − 1).
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, Binomial Distribution (checked 2026-10-29)
- Microsoft Support, BINOM.DIST function (checked 2026-10-29)
- R documentation, The Binomial Distribution (checked 2026-10-29)
- SciPy documentation, scipy.stats.binom (checked 2026-10-29)








