Binomial Distribution Calculator
Enter a fixed trial count, one success probability and the count to test. Choose exactly, fewer than, at most, more than, at least or a range. The graph shades the selected counts; open Calculation steps for the working or Probability table for numeric PMF and cumulative values.
The probability of exactly k successes in n trials, which is the one term C(n, k) times p to the k times (1 - p) to the rest.
Probabilities are shown to six decimal places and agree with exact rational arithmetic to within 1e-9. Anything below 0.00001 keeps its digits as an exponent rather than rounding away to zero, and a probability that is certain by definition is written as a plain 1 or 0. P(X = 6) = C(20, 6) * 0.3^6 * 0.7^14
Each bar is the probability of exactly that count. The shaded bar is the one count P(X = 6) covers. The most likely count is 6, at 0.191639.
Calculation steps
- Let X count successes in 20 independent trials, each with p = 0.3.
- P(X = 6): Include only count 6.
- For each included count j, use C(20, j) * 0.3^j * 0.7^(20 - j). C(n, j) = n! / (j! * (n - j)!).
- P(X = 6) = C(20, 6) * 0.3^6 * 0.7^14. Result: P(X = 6) = 0.191639.
- Mean = n * p = 6; variance = n * p * (1 - p) = 4.2; standard deviation = sqrt(variance) = 2.0494.
Probability table
All 21 possible counts are listed.
| Count j | P(X = j) | P(X <= j) | P(X >= j) | In event |
|---|---|---|---|---|
| 0 | 0.000798 | 0.000798 | 1 | No |
| 1 | 0.006839 | 0.007637 | 0.999202 | No |
| 2 | 0.027846 | 0.035483 | 0.992363 | No |
| 3 | 0.071604 | 0.107087 | 0.964517 | No |
| 4 | 0.130421 | 0.237508 | 0.892913 | No |
| 5 | 0.178863 | 0.416371 | 0.762492 | No |
| 6 | 0.191639 | 0.608010 | 0.583629 | Yes |
| 7 | 0.164262 | 0.772272 | 0.391990 | No |
| 8 | 0.114397 | 0.886669 | 0.227728 | No |
| 9 | 0.065370 | 0.952038 | 0.113331 | No |
| 10 | 0.030817 | 0.982855 | 0.047962 | No |
| 11 | 0.012007 | 0.994862 | 0.017145 | No |
| 12 | 0.003859 | 0.998721 | 0.005138 | No |
| 13 | 0.001018 | 0.999739 | 0.001279 | No |
| 14 | 0.000218 | 0.999957 | 0.000261 | No |
| 15 | 0.000037 | 0.999994 | 0.000043 | No |
| 16 | 5.0076e-6 | 0.999999 | 5.5503e-6 | No |
| 17 | 5.0496e-7 | > 0.999999 | 5.4269e-7 | No |
| 18 | 3.6069e-8 | > 0.999999 | 3.7731e-8 | No |
| 19 | 1.6272e-9 | > 0.999999 | 1.6620e-9 | No |
| 20 | 3.4868e-11 | 1 | 3.4868e-11 | No |
Worked examples
The cases a binomial question usually starts from. Every figure here is computed by the same code as the answer above, so the examples and the tool can never disagree.
Common questions
- How do I calculate a binomial probability?
- Enter n in Trials, the chance of one success in Probability, and k in Count, then choose the event. For Exactly, P(X = k) = C(n, k) * p^k * (1 - p)^(n - k). With n = 20, p = 0.3 and k = 6, that is C(20, 6) * 0.3^6 * 0.7^14 = 0.191639. Calculation steps identifies the included integer counts, substitutes the numbers and shows the result.
- What is the difference between the binomial PMF and the CDF?
- The PMF gives one exact count; the cumulative distribution function, or CDF, includes that count and every count below it. At n = 20 and p = 0.3, P(X = 6) is 0.191639 and P(X <= 6) is 0.608010. Both appear in the readout. At most includes k; Fewer than stops at k - 1.
- How do I find the probability of at least k successes?
- Choose At least to include k through n. At n = 20 and p = 0.3, P(X >= 7) is 0.391990. More than instead begins at k + 1. Small tails are summed directly to preserve their digits: at n = 100,000 and p = 0.005, P(X >= 1000) is 9.3711e-87, even though the cumulative probability below 1000 has rounded to 1.
- What are the mean, variance and standard deviation of a binomial distribution?
- The expected value or mean is n * p, the variance is n * p * (1 - p), and the standard deviation is the square root of the variance. At n = 20 and p = 0.3, the mean is 6, variance is 4.2 and standard deviation is 2.0494. These describe the count of successes, and all three appear beside the probability.
- Can I enter the probability as a percentage or a fraction?
- Yes: use a decimal like 0.3, a percentage like 30% or a fraction like 1/6. The readout states how a percentage or fraction was read. For 10 independent die rolls with a six counted as success, p = 1/6 and P(X = 2) is 0.290710. A zero denominator or a probability outside 0 to 1 is refused with an explanation.
- How many trials can this handle?
- The trial count runs from 1 through 100,000. Larger counts are refused rather than cut down. Log-gamma factorials keep the binomial coefficient in logarithmic form until the final probability is exponentiated. At n = 100,000, p = 0.005 and k = 500, P(X = 500) is 0.017883.
- What happens when p is 0 or 1?
- The count is certain. At p = 0, X is always 0; at p = 1, X is always n. The event is returned as exact 0 or 1. Other probabilities use floating-point arithmetic, and near-certain values are distinguished from exact certainty in the displayed result.
- How are very small probabilities displayed?
- Readout probabilities normally show six decimal places. Values below 0.00001 use scientific notation, and a probability that underflows floating-point storage is labelled < 1e-308. Approximate values close enough to 1 to round there carry a greater-than label; only probabilities certain by the model are printed as plain 1.
- When is the binomial distribution the wrong model?
- The model needs a fixed trial count, independent trials and the same success probability on every trial. Drawing cards without replacement changes the chance on each draw and needs a different model. This tool does not compute negative, beta-binomial or unequal-probability Poisson-binomial distributions, normal approximations, hypothesis-test p-values, inverse counts or sample-size planning.
- Can I calculate coin-flip or binary-outcome probabilities?
- Yes. Count heads as success and enter the number of independent flips as n. A fair coin has p = 1/2; a biased coin needs its known chance of heads. At n = 10 and p = 1/2, exactly 5 heads has probability 0.246094 and at least 8 heads has probability 0.054688. A binary distribution here means a count of independent success-or-failure trials, rather than arithmetic on base-two numbers.
- What does the probability table include?
- Open Probability table for each count j, P(X = j), P(X <= j), P(X >= j) and whether j belongs to the selected event. Through 200 trials it lists every possible count. Above that it lists the same 41-count window as the graph; changing Count moves the window. The cumulative columns still include the full distribution outside the displayed window. The table can scroll across columns and down rows.
- What is the z score of a binomial count?
- The Z score of Count readout gives (k - n * p) / sqrt(n * p * (1 - p)), the entered count’s distance from the mean in standard deviations. It is undefined when p is 0 or 1 because the variance is zero. This standardized count is descriptive; it does not replace the binomial probability with a normal approximation or perform a hypothesis test.
- Does opening a coin-flip preset change my remembered inputs?
- Opening the preset uses its own trial count and probability without writing them into browser storage. Only a control you actually change is saved, with other remembered main-page values retained. Inputs are remembered locally when browser storage is available; calculations also work when storage is blocked.
- How can I work a binomial probability without a calculator?
- For three independent fair-coin flips, at least two heads means exactly two or exactly three. C(3,2) = 3!/(2!*1!) = 3 and C(3,3) = 1. Each arrangement has probability (1/2)^3 = 1/8, so the sum is 3/8 + 1/8 = 4/8 = 1/2. For another fixed n and p, calculate C(n,j) * p^j * (1-p)^(n-j) for each included integer count j and add those terms. At most k uses j=0 through k; more than k uses k+1 through n.
Probabilities use jstat 1.9.6 log-gamma factorials to avoid factorial overflow, with representable small tails summed directly; smaller values can underflow floating-point storage. The model assumes a fixed number of independent trials with one shared probability, and p = 0 and p = 1 are returned exactly. It describes a distribution and predicts nothing about whatever you are counting.