HomeStatistics & Probability › Binomial Distribution Calculator

Binomial Distribution Calculator

Computes the probability of exactly, at most, at least, fewer than or more than k successes in n independent trials with success probability p, plus the mean, variance and standard deviation of the distribution.

When to use

You have a fixed number of independent yes/no trials with a constant success probability (coin flips, defect counts in a batch, conversions among n visitors) and need the probability of a number of successes.

Do not use when: Trials are not independent or p changes, the number of trials is not fixed, or you count events over time or space at an average rate (use poisson-distribution).

Formula

P(X = k) = C(n, k) · p^k · (1 − p)^(n − k); P(X ≤ k) = Σ_{i=0..k} P(X = i); P(X ≥ k) = Σ_{i=k..n} P(X = i); mean = n·p; variance = n·p·(1 − p)

Probabilities are computed term by term in log space, so large n does not overflow the binomial coefficient. Results are exact (no normal approximation).

Inputs

ParameterTypeUnitRequiredDescription
trialsintegeryesTotal number of independent trials. Range: ≥ 1, ≤ 100000
successesintegeryesNumber of successes of interest (0 ≤ k ≤ n). Range: ≥ 0, ≤ 100000
probability_of_successnumberyesProbability of success on a single trial, as a number between 0 and 1 (0.5 for 50 %), not a percentage. Range: ≥ 0, ≤ 1

Outputs

OutputTypeUnitDescription
probability_exactnumberProbability of exactly k successes.
probability_at_mostnumberCumulative probability of k or fewer successes.
probability_at_leastnumberProbability of k or more successes.
probability_less_thannumberProbability of fewer than k successes.
probability_more_thannumberProbability of more than k successes.
meannumberExpected number of successes n·p.
variancenumbern·p·(1 − p).
std_devnumber√(n·p·(1 − p)).

Example

3 heads in 10 fair coin flips: {"trials":10,"successes":3,"probability_of_success":0.5}{"probability_exact":0.117188,"probability_at_most":0.171875,"probability_at_least":0.945313,"probability_less_than":0.054688,"probability_more_than":0.828125,"mean":5,"variance":2.5,"std_dev":1.5811}

2 defects in 20 items at 10 %: {"trials":20,"successes":2,"probability_of_success":0.1}{"probability_exact":0.28518,"probability_at_most":0.676927,"probability_at_least":0.608253,"mean":2,"variance":1.8,"std_dev":1.3416}

GET https://tttkmbb.com/api/v1/calculate/binomial-distribution?trials=10&successes=3&probability_of_success=0.5

Machine access

Sources

FAQ

Is p a percentage?

No. Enter the single-trial success probability as a fraction between 0 and 1: 0.25 for 25 %.

When can the normal approximation be used instead?

When n·p ≥ 10 and n·(1 − p) ≥ 10 the binomial is close to a normal with mean n·p and SD √(n·p·(1 − p)); this calculator does not need the approximation because it computes the exact sum.

Related calculators