statcompute

Distributions

Binomial Distribution Calculator

The probability of exactly k successes — or at most, or at least — in a fixed number of independent trials.

Updated August 2026Runs in your browser — nothing is uploadedVerified against R
Between 0 and 1, and the same for every trial.
All five are computed and shown in the table; this picks the headline.

The calculation runs in your browser, so this box needs JavaScript. The formula, the worked example and the interpretation below do not.

01

How to read this result

Four conditions define a binomial situation, and all four must hold: a fixed number of trials, exactly two outcomes per trial, the same probability of success every time, and trials that do not influence each other. Sampling without replacement from a small population breaks the last two.

The five probabilities in the table are not interchangeable. P(X = 3) is one bar; P(X ≤ 3) is four bars; P(X < 3) is three. Off-by-one errors here are the most common mistake with discrete distributions, which is why all five are always shown.

The mean is np and the standard deviation √(np(1−p)). Ten trials at 30% average three successes, give or take about 1.45.

Exact, not approximated. Some tools switch to a normal approximation for large n; this one computes the binomial itself in log space, so n in the tens of thousands is still exact. The approximation is worth knowing about — it needs np ≥ 10 and n(1−p) ≥ 10 — but it is never necessary here.

02

The formula

P(X=k)=(nk)pk(1p)nk
(nk)
the number of ways to choose which k trials succeed
pk
the probability that those k succeed
(1p)nk
the probability that the rest fail

Mean np, variance np(1 − p). The binomial coefficient is computed as an exponential of log-gamma, so it does not overflow at large n.

03

Worked example

Three defective units in a batch of ten

A process produces defective units 30% of the time. Ten units are inspected. What is the probability that exactly three are defective — and that no more than three are?

  1. Count the ways to pick which three of the ten are defective.
    C(10, 3) = 120
  2. The probability of any one such arrangement.
    0.3³ × 0.7⁷ = 0.027 × 0.0823543 = 0.0022236
  3. Multiply.
    P(X = 3) = 120 × 0.0022236 = 0.26683
  4. For “at most three”, add the cases k = 0, 1, 2, 3.
    0.02825 + 0.12106 + 0.23347 + 0.26683 = 0.64961
  5. The mean and standard deviation of the distribution.
    np = 3.0 √(np(1−p)) = √2.1 = 1.449
P(X = 3) 0.2668P(X ≤ 3) 0.6496mean 3.0SD 1.449

Three defectives is the single most likely outcome and still happens only about a quarter of the time. That is worth remembering whenever a “most likely” result is treated as the expected one.

Checked against R's dbinom(3, 10, 0.3) and pbinom(3, 10, 0.3).

The calculator above is loaded with these numbers by the Load the worked example button.

04

Assumptions, and when to use something else

  • A fixed number of trials, decided in advance. Stopping when you get a result you like is a different distribution (negative binomial).
  • Two outcomes per trial, however you define them.
  • A constant probability, identical on every trial.
  • Independent trials. Drawing cards without replacement violates this — that situation is hypergeometric, and the binomial is a good approximation only when the sample is a small fraction of the population.
  • Counting events in time or space, not successes in trialsPoisson distributionArrivals per hour, defects per metre — no fixed number of trials.
  • Sampling without replacement from a small populationProbability calculatorThe hypergeometric situation, where each draw changes the odds.
  • n is large and you want the normal approximationNormal distributionValid once np and n(1−p) both exceed about 10 — though the exact binomial above needs no approximation.
  • Testing whether an observed proportion differs from expectedz-test for proportionsThe inferential counterpart of this distribution.
05

Questions people ask

What is the difference between P(X = k) and P(X ≤ k)?

P(X = k) is exactly k successes — one bar of the chart. P(X ≤ k) is k or fewer — that bar plus all the ones to its left. The calculator shows all five variants because picking the wrong one is the most common error with discrete distributions.

When can I use the normal approximation to the binomial?

The usual rule is np ≥ 10 and n(1 − p) ≥ 10. Below that the binomial is noticeably skewed and the approximation misjudges the tails. This calculator computes the exact binomial regardless of n, so the question rarely arises in practice.

Can the binomial handle large n?

Yes. Everything is computed in log space, so n = 100,000 is fine. A formula written directly with factorials would fail at n = 171, where 171! overflows a double.

What is a binomial experiment?

Any situation with a fixed number of independent trials, two outcomes each, and a constant success probability: coin flips, quality inspections, survey yes/no answers, free throws.