Free binomial distribution calculator. Enter n, p, and k for the exact P(X=k), P(X<=k), P(X>=k), mean and variance, plus a bar chart of the distribution.
Enter three numbers — n (how many trials), p (the probability any single trial succeeds) and k (the number of successes you care about) — and this calculator returns P(X = k), P(X ≤ k), P(X ≥ k), the mean np, the variance np(1 − p) and the standard deviation. It also draws the full distribution as a bar chart with your chosen k highlighted, and prints the formula with your own numbers substituted in, so you can copy the working into homework or a report.
Everything runs in your browser. Nothing you type is uploaded, and the arithmetic is exact combinatorics rather than a lookup table — the binomial coefficient is built up iteratively (multiply by n − i, divide by i + 1) so that values like C(1000, 500) do not blow past what a factorial can hold.
This is the part that costs people marks and, in the workplace, costs them a wrong answer they trust. The binomial distribution is not a general-purpose "probability of some successes" formula. It is the exact answer to one narrowly defined situation, and all four of these must be true:
n before you start. "I inspected parts until I found a defect" is not binomial — the trial count is itself random there (that is a geometric or negative binomial situation).p across every trial. If the probability drifts — a machine warming up, a tester getting faster, a lottery drum that is not refilled — the binomial answer is wrong.The calculator cannot check any of this for you. It will happily compute a beautifully precise number for a situation the binomial does not describe. Reading these four conditions against your actual problem is the one step that has to happen in your head.
Most wrong binomial answers are not arithmetic errors — they are the right formula answering a slightly different question. The calculator gives all three at once so you can pick the one that matches your sentence:
| Wording in the question | What you want | Called |
|---|---|---|
| "exactly 3", "precisely 3" | P(X = 3) | pmf (probability mass) |
| "at most 3", "3 or fewer", "no more than 3" | P(X ≤ 3) | cdf (cumulative) |
| "at least 3", "3 or more" | P(X ≥ 3) = 1 − P(X ≤ 2) | upper tail |
| "fewer than 3", "under 3" | P(X ≤ 2) | cdf at k − 1 |
| "more than 3", "over 3" | 1 − P(X ≤ 3) | upper tail at k + 1 |
The two rows that catch people are "fewer than" and "more than", both of which are strict inequalities and therefore exclude k itself. If a question says "more than 3 defects", set k to 3, read P(X ≥ 3) — and then realise that is not it, because P(X ≥ 3) includes exactly 3. Either set k to 4 and read P(X ≥ 4), or take 1 minus the P(X ≤ 3) shown at k = 3. Both give the same figure.
Note also that P(X ≤ k) and P(X ≥ k) overlap: they both contain P(X = k), so they add up to more than 1. That is expected, not a bug.
A supplier's process produces a defective unit 5% of the time. You pull 20 units off the line as an audit sample. What is the chance of finding exactly 2 defects, and what is the chance of finding 2 or more?
Set n = 20, p = 0.05, k = 2. The formula is
P(X = k) = C(n, k) · p^k · (1 − p)^(n − k)
Substituting: C(20, 2) = (20 × 19) / 2 = 190. Then p^k = 0.05² = 0.0025. Then (1 − p)^(n − k) = 0.95^18 ≈ 0.3972143. Multiply the three:
190 × 0.0025 × 0.3972143 = 0.1886768
So P(X = 2) ≈ 0.188677, or 18.87%. Roughly a one-in-five chance the audit turns up precisely two bad units.
For "2 or more" you go through the complement, because the tail is infinite in the unhelpful direction — it is far less work to add up the two cases you do not want:
The summary statistics for the same setup: mean = np = 20 × 0.05 = 1 defect, variance = np(1 − p) = 20 × 0.05 × 0.95 = 0.95, standard deviation = √0.95 ≈ 0.9747.
That mean of exactly 1 is worth sitting with. The expected number of defects in the sample is one — and yet the single most likely individual outcome is one defect at 37.7%, with zero defects close behind at 35.8%. A clean sample of 20 is not evidence the process improved. It happens more than a third of the time when nothing has changed at all.
The mean np is where the distribution balances. The variance np(1 − p) tells you how far individual results scatter around it, and it behaves in a way that is easy to remember: it is largest when p = 0.5 and shrinks towards zero as p approaches either 0 or 1. That matches intuition. A coin is maximally unpredictable; an event that almost never happens, or almost always happens, produces results that cluster tightly at one end.
The standard deviation √[np(1 − p)] is the more useful of the two day-to-day, because it is in the same units as the count. For n = 20, p = 0.05 it is about 0.97 defects — so a result of 3 defects is roughly two standard deviations above the expected 1, unusual but not extraordinary. The calculator prints all three.
| Input | Accepted | What happens outside it |
|---|---|---|
| n (trials) | whole number, 1 to 1000 | the field flags and the results hold at the last valid entry |
| p (probability) | 0 to 1 inclusive | rejected — enter 0.05, not 5 |
| k (successes) | whole number, 0 to n | rejected; k above n has probability 0 by definition |
| bar chart | drawn for n ≤ 60 | hidden above that; the numbers stay exact to n = 1000 |
The single most common input error is entering p as a percentage. A 5% rate is 0.05. Typing 5 is out of range and the tool will tell you so, but typing 0.5 when you meant 5% will not be flagged — it is a perfectly valid probability, just a tenfold overstatement of your defect rate.
A second trap is treating a very large n with a very small p as if the chart shape were reliable. The mathematics stays exact, but you have moved into territory where the Poisson distribution with λ = np is the conventional model, and where p itself — usually estimated from past data — carries more uncertainty than the sixth decimal place of the output implies. The calculator's precision is a property of the arithmetic, not of your input.
Finally, remember what the discreteness means. X counts whole successes, so the distribution is a set of separate bars, not a curve. There is no P(X = 2.5). For continuous quantities — heights, times, measurement errors — you want the normal distribution calculator instead, which is also the standard approximation to the binomial once n is large and p is not close to either extreme.
It is the probability distribution of the number of successes in a fixed number of independent trials, where each trial has the same probability of success. The classic example is counting heads in a set number of coin flips. It is defined by two parameters: n (the number of trials) and p (the probability of success on each trial).
Four conditions, often called Bernoulli trials: a fixed number of trials, exactly two possible outcomes per trial (success or failure), a constant probability of success across all trials, and independence between trials. If any condition fails — for example, drawing cards without replacement changes the probability each draw — a different distribution applies.
Use P(X = k) = C(n, k) × p^k × (1 − p)^(n − k). Compute the binomial coefficient C(n, k) for the number of arrangements, multiply by p raised to the number of successes, and by (1 − p) raised to the number of failures. This calculator evaluates that formula exactly and also sums it to give cumulative probabilities.
P(X = k) is the probability of exactly k successes — a single term of the formula. P(X <= k) is the cumulative probability of k or fewer successes, found by adding the terms for 0 through k. P(X >= k) is the probability of k or more, equal to 1 minus P(X <= k − 1). This tool reports all three at once.
The mean (expected number of successes) is np, and the variance is np(1 − p). For example, 100 trials at p = 0.3 have a mean of 30 successes and a variance of 21, giving a standard deviation of about 4.58. These let you summarize the distribution without listing every outcome.