Calcady
Home / Scientific / Binomial Probability Calculator

Binomial Probability Calculator

Calculate exact and cumulative binomial probabilities given the number of trials, probability of success, and target successes. Used in A/B testing, quality control, and statistical inference.

Experiment Details

Calculated Probabilities

Exact Probability P(X = 5)24.609%Decimal: 0.24609
At Most 5P(X ≤ 5)
62.305%0.62305
At Least 5P(X ≥ 5)
62.305%0.62305
Email LinkText/SMSWhatsApp

Binomial Probability

The Binomial Distribution describes the probability of having exactly k successes in n independent yes/no experiments, where the probability of success p is the same for every trial.

The Formula

The exact probability of exactly k successes is given by the binomial probability mass function (PMF):

P(X = k) = ⁿCₖ · pᵏ · (1 - p)ⁿ⁻ᵏ
  • n: Number of Trials (e.g., flipping a coin 10 times).
  • p: Probability of Success on a single trial (e.g., 0.5 for heads).
  • k: Target Number of Successes (e.g., exactly 4 heads).
  • ⁿCₖ: "n choose k", the binomial coefficient representing the number of ways to arrange the successes.

Cumulative Probabilities

Often, you don't just want the probability of exactly k successes, but rather the probability of answering questions like "What are the odds of getting at least 7 heads?" or "at most 2 defects?".

  • P(X ≤ k): Cumulative probability of getting k or fewer successes.
  • P(X ≥ k): Cumulative probability of getting k or more successes.

Quick Answer: How do you calculate binomial probability?

P(X = k) = C(n,k) × pk × (1−p)n−k, where C(n,k) = n! / (k!(n−k)!) is the number of combinations. Example: flipping a fair coin 10 times (n=10, p=0.5), what is the probability of getting exactly 7 heads (k=7)? C(10,7) = 120. P(X=7) = 120 × (0.5)7 × (0.5)3 = 120 × (0.5)10 = 120/1024 = 11.72%. For cumulative probability (“7 or more heads”): P(X≥7) = P(7) + P(8) + P(9) + P(10) = 11.72% + 4.39% + 0.98% + 0.098% = 17.19%.

Binomial Distribution Reference: n=10, Various p

P(X = k) for 10 trials at different success probabilities. Rows are number of successes k; columns are probability of success per trial p. Values rounded to 4 decimal places.

k (successes) p = 0.10 p = 0.25 p = 0.50 p = 0.75 p = 0.90
k = 00.34870.05630.00100.00000.0000
k = 10.38740.18770.00980.00010.0000
k = 20.19370.28160.04390.00040.0000
k = 30.05740.25030.11720.00310.0001
k = 40.01120.14600.20510.01620.0001
k = 50.00150.05840.24610.05840.0015
k = 60.00010.01620.20510.14600.0112
k = 70.00000.00310.11720.25030.0574
k = 80.00000.00040.04390.28160.1937
k = 90.00000.00010.00980.18770.3874
k = 100.00000.00000.00100.05630.3487
Note the symmetry: P(X=k | p) = P(X=n\u2212k | 1\u2212p). The distribution at p=0.25 is the mirror of p=0.75. The distribution at p=0.50 is symmetric around k=5 (the peak, 0.2461). All columns sum to 1.0000.

Pro Tips & Common Binomial Probability Mistakes

Do This

  • Use the cumulative CDF for hypothesis testing, not the exact PMF. In A/B testing and quality control, the question is rarely “what is the probability of exactly k events?” — it is usually “what is the probability of k or more events if the null hypothesis is true?” This is the p-value: P(X ≥ kobserved | H0). If this right-tail probability is below your significance level α (typically 0.05), reject H0. Using P(X = k) alone will give you too small a value and lead to premature rejection of the null hypothesis.
  • Always verify the four binomial conditions before applying the formula. The four required conditions: (1) fixed n, (2) independence, (3) binary outcomes, (4) constant p. If p changes per trial (e.g., sampling without replacement, or a drug whose effect changes over time), the binomial model is incorrect. Sampling without replacement from a population where n is more than 5% of the total population requires the hypergeometric distribution. Non-constant p may require a beta-binomial or logistic regression model instead.

Avoid This

  • Don't stop an A/B test early when you see significance — this is “peeking” and inflates Type I error dramatically. If you check significance after every new conversion and stop when p < 0.05, your actual Type I error rate can exceed 30% even with α = 0.05. The binomial p-value is only valid if you predetermined the sample size n before starting the test. If you need early stopping, use Sequential Probability Ratio Test (SPRT) or a Bayesian approach with pre-registered stopping rules. “Two-week test, check once at the end” is the simplest correct approach for practitioners.
  • Don't confuse P(X = k) with P(X ≤ k) or P(X ≥ k) — they answer different questions. P(X = 7) for coin flips = 11.72% (exactly 7 heads). P(X ≤ 7) = 94.5% (7 or fewer heads). P(X ≥ 7) = 17.2% (7 or more heads). These are fundamentally different probabilities. In quality control: “probability that exactly 2 units are defective” (PMF) vs “probability that 2 or more units are defective” (1 − CDF of 1) vs “probability that at most 2 are defective” (CDF of 2). Specify precisely which quantity you need before calculating.

Frequently Asked Questions

How do I use binomial probability for A/B testing?

In a one-proportion binomial test: H0: p = p0 (control rate) vs Ha: p ≠ p0 (two-tailed) or p > p0 (one-tailed for detecting improvement). The p-value = P(X ≥ kobserved | n, p0) for a right-tail test. Example: historical conversion rate 8% (p0=0.08), n=200 visitors, k=22 conversions observed. P(X ≥ 22 | n=200, p=0.08) ≈ 6.4%. Since 6.4% > 5%, do not reject H0 at α=0.05 — the improvement is not statistically significant. If k=24 is observed, P(X ≥ 24) ≈ 2.9% < 5% → statistically significant. For two-group A/B tests comparing two proportions, use the two-proportion z-test or chi-squared test instead — those account for variance in both groups simultaneously.

When should I use the Normal approximation instead of the exact binomial?

Use the Normal approximation when np ≥ 5 AND n(1−p) ≥ 5. With modern calculators, there is rarely a practical reason to use the approximation — the exact binomial is computable for any feasible n. However, the approximation remains important for understanding: z-tests for proportions use X ~ N(μ=np, σ²=np(1−p)) exactly. Apply the continuity correction: P(X = k) ≈ P(k−0.5 < Z < k+0.5); P(X ≤ k) ≈ P(Z < k+0.5). Without the continuity correction, the approximation error can be 10–20% for moderate n. Use the Poisson approximation instead when n > 100 and p < 0.01 (rare events) — Poisson(λ=np) often gives a better approximation than Normal for skewed rare-event distributions.

What is the binomial coefficient C(n,k) and how do I calculate it for large n?

C(n,k) = n! / (k!(n−k)!) counts the number of distinct ways to choose k items from n without regard to order. For large n, factorial directly overflows double-precision floating point (n=171! exceeds 10308). Compute in log space instead: ln(C(n,k)) = ln(n!) − ln(k!) − ln((n−k)!) using the log-gamma function (lgamma in most math libraries): log_C = lgamma(n+1) − lgamma(k+1) − lgamma(n−k+1). Then C(n,k) = exp(log_C) and P(X=k) = exp(log_C + k×ln(p) + (n−k)×ln(1−p)). This approach computes exact binomial probabilities for any n without overflow. Alternatively, use Pascal's triangle identity C(n,k) = C(n−1,k−1) + C(n−1,k) for recursive computation.

How is the binomial distribution used in quality control (AQL sampling)?

Acceptance Quality Limit (AQL) sampling (per ISO 2859/ANSI Z1.4) uses the binomial distribution to determine rejection thresholds. A sampling plan specifies: sample n units from a lot; accept the lot if fewer than c defects are found (reject if ≥ c). The Producer's Risk (α) is the probability of rejecting a good lot: α = P(X ≥ c | p = AQL). The Consumer's Risk (β) is the probability of accepting a bad lot: β = P(X < c | p = LTPD), where LTPD is an unacceptable defect rate. Example: n=50, c=2, AQL=2%, LTPD=10%. α = P(X ≥ 2 | n=50, p=0.02) = 1 − P(X=0) − P(X=1) = 1 − 0.3642 − 0.3716 = 0.264 (26.4% producer's risk). β = P(X < 2 | n=50, p=0.10) = P(X=0) + P(X=1) = 0.005 + 0.029 = 3.4% consumer's risk. AQL tables in ISO 2859 are pre-calculated binomial CDFs organized by batch size and quality level.

Related Calculators