Skip to main content
v2026.11,858 entries · CC-BY 4.0

Binomial Probability Calculator: Formula, Table and Code

Calculate binomial probability with the formula, a lookup table for n = 10, two worked examples, and Excel, R and Python functions.

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?

  1. C(12, 3) = 220.
  2. p3 = 0.23 = 0.008.
  3. (1 − p)9 = 0.89 = 0.134217728.
  4. 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 = FALSE returns 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

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Binomial Probability Calculator: Formula, Table and Code

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.