Binomial Distribution Calculator
Enter the number of trials n, the success probability p and a number of successes k to get the exact probability P(X=k) and every cumulative form (≤, <, ≥, >, between), plus the mean, variance, standard deviation and mode — with a PMF chart and the formula worked out on your own numbers. No signup.
How it works
A binomial experiment is a fixed number of independent trials, each a success or a failure with the same success probability p. The random variable X counts the successes. The chance of getting exactly k of them is given by the binomial probability mass function (NIST §1.3.6.6.18):
P(X = k) = C(n, k) · pᵏ · (1 − p)ⁿ⁻ᵏ
Here C(n, k) = n! / (k!·(n−k)!) is the binomial coefficient — the number of distinct ways to arrange k successes among n trials — while pᵏ is the probability of those k successes and (1−p)ⁿ⁻ᵏ the probability of the remaining failures. The cumulative questions are sums of this one formula:
- At most k: P(X ≤ k) = Σ P(X = j), j = 0…k
- Less than k: P(X < k) = P(X ≤ k − 1)
- At least k: P(X ≥ k) = 1 − P(X ≤ k − 1)
- More than k: P(X > k) = 1 − P(X ≤ k)
- Between: P(k ≤ X ≤ k₂) = P(X ≤ k₂) − P(X ≤ k − 1)
To stay exact for large n, the calculator evaluates every term in log-space using a Lanczos log-gamma (DLMF §5): ln P(X=k) = lnΓ(n+1) − lnΓ(k+1) − lnΓ(n−k+1) + k·ln p + (n−k)·ln(1−p), then P = exp(ln P). This avoids the overflow that a direct C(n, k) would hit past a few hundred trials. Cumulative sums run from the nearer tail so the running total is short and accurate, and P(X ≥ k) is taken as the complement 1 − P(X ≤ k − 1). The degenerate cases p = 0 and p = 1 put all the probability at k = 0 or k = n and are handled directly. As an independent check, the tool also builds the CDF from the recurrence P(k) = P(k−1)·[(n−k+1)/k]·p/(1−p) starting at P(0) = (1−p)ⁿ and shows the two methods agree.
The distribution summary uses the standard results μ = np for the mean, σ² = np(1−p) for the variance and σ = √(np(1−p)) for the standard deviation, with the mode at ⌊(n+1)p⌋ (two adjacent modes when (n+1)p is a whole number), all per Wolfram MathWorld. When both np ≥ 5 and n(1−p) ≥ 5 the shape is close enough to a bell curve that the normal approximation N(np, np(1−p)) is reasonable, and the tool flags this with a continuity-correction reminder.
Worked examples
Frequently asked questions
Sources & references
- NIST/SEMATECH e-Handbook §1.3.6.6.18 — Binomial Distribution (PMF, mean np, variance np(1−p))
- Wolfram MathWorld — Binomial Distribution (PMF, CDF, mode ⌊(n+1)p⌋)
- NIST Digital Library of Mathematical Functions §5 — Gamma function (log-gamma basis)
The formulas here were last cross-checked against these sources on 2026-07-08. They are mathematical constants, not policy, so they do not change with the calendar.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.