Binomial Distribution Calculator: P(X=k), Mean & Chart Free

This free binomial distribution calculator finds the probability of getting exactly k successes in n independent trials, each with success probability p. Enter your values below and it instantly returns P(X = k), the cumulative probabilities, the mean, variance and standard deviation, plus a probability bar chart of the whole distribution.

whole number, 1 to 1000
between 0 and 1
whole number, 0 to n
P(X = k)
P(X ≤ k)
P(X < k)
P(X ≥ k)
P(X > k)
Mean (np)
Variance
Std dev
Enter n, p and k, then press Calculate.
Free tool by mlforbeginners.com · embed it: <iframe src="https://mlforbeginners.com/binomial-distribution-calculator/"></iframe>

What is the binomial distribution?

The binomial distribution describes the number of successes in a fixed number of independent yes/no trials — coin flips, pass/fail tests, click/no-click, defective/not-defective. If you run n trials and each one succeeds with the same probability p, then the count of successes X follows a binomial distribution, written \(X \sim \text{Binomial}(n, p)\). This calculator gives you the exact probability of any outcome, the running (cumulative) totals, and the shape of the whole distribution.

The binomial probability formula

The probability of getting exactly k successes is:

\( P(X = k) = \binom{n}{k}\, p^{k}\,(1-p)^{\,n-k} \)

  • \(\binom{n}{k} = \dfrac{n!}{k!\,(n-k)!}\) is the binomial coefficient — the number of ways to choose which k of the n trials are successes.
  • \(p^{k}\) is the chance those k trials all succeed; \((1-p)^{n-k}\) is the chance the rest all fail.

This tool computes the coefficient with log-gamma functions, so it stays accurate even for large n where factorials would overflow.

How to use the binomial distribution calculator

The binomial distribution calculator takes three inputs. Enter the number of trials n, the success probability p for a single trial, and the number of successes k you care about, then press Calculate. The binomial distribution calculator immediately returns the exact probability P(X = k), every cumulative probability, the mean, variance and standard deviation, plus a bar chart of the whole distribution with your value of k highlighted. Everything recalculates as you type, so the binomial distribution calculator also doubles as a quick way to explore how changing n or p reshapes the distribution.

When can you use it?

A situation is binomial only when all four conditions hold:

  • Fixed number of trials n, decided in advance.
  • Two outcomes per trial (success or failure).
  • Constant probability p on every trial.
  • Independent trials — one result does not affect the next.

If those hold, the mean number of successes is \(\mu = np\), the variance is \(\sigma^2 = np(1-p)\), and the standard deviation is \(\sigma = \sqrt{np(1-p)}\) — all shown above.

A worked example

Suppose a free-throw shooter makes 30% of attempts and takes 20 shots, so n = 20 and p = 0.3. The expected number made is \(np = 6\). Enter those values (or press Load example) and the binomial distribution calculator shows P(X = 6) ≈ 0.192, the chance of making 6 of 20, while the bar chart reveals that outcomes near 6 are most likely and the tails fall away quickly.

Binomial in machine learning

The binomial distribution underpins logistic regression, A/B-test significance, classification accuracy as a count of correct predictions, and Bernoulli trials throughout probability. Getting comfortable with it makes the leap to the normal distribution (its large-n approximation) and the Poisson distribution much easier. For a deeper treatment, see the overview of the binomial distribution on Wikipedia.

Frequently asked questions

What is the difference between P(X = k) and P(X ≤ k)? P(X = k) is the probability of exactly k successes; P(X ≤ k) is the cumulative probability of k or fewer. This calculator shows both, plus the upper tails.

What are n, p and k? n is the number of trials, p is the probability of success on each trial, and k is the specific number of successes whose probability you want.

When should I use a normal approximation instead? When n is large and p is not too close to 0 or 1 (a common rule is \(np \ge 5\) and \(n(1-p) \ge 5\)), the binomial is well approximated by a normal distribution with the same mean and variance.

Does my data leave my device? No. Everything is computed locally in your browser.

Scroll to Top