induwara.lk
induwara.lkStatistics · Probability

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.

By Induwara AshinsanaUpdated Jul 8, 2026
Binomial probabilityP(X = k), cumulative & distribution stats
NIST formula · cross-checked

Whole number, 1 to 100,000.

Decimal like 0.25, or a percent like 25%.

Probability type

Whole number of successes, 0 to n.

Examples
Selected probability
P(X = 6) = 0.205078
20.51%≈ 1 in 5
P(X = 6)
20.51%
0.205078
P(X < 6)
62.3%
0.623047
P(X ≤ 6)
82.81%
0.828125
P(X ≥ 6)
37.7%
0.376953
P(X > 6)
17.19%
0.171875

Distribution summary

Mean μ = np
5
Variance σ² = np(1−p)
2.5
Std dev σ
1.5811
Mode ⌊(n+1)p⌋
5

Normal approximation available

X ≈ N(μ = 5, σ² = 2.5); μ ± σ ≈ [3.419, 6.581]

0246810
PMF over all k = 0–10 — shaded bars are the selected region.

Show working

recurrence check Δ = 1.1e-16
  1. P(X = k) = C(n, k) · pᵏ · (1−p)ⁿ⁻ᵏ
  2. = C(10, 6) · 0.5^6 · 0.5^4
  3. C(10, 6) = 210
  4. 0.5^6 = 0.015625 0.5^4 = 0.0625
  5. P(X = 6) = 210 · 0.015625 · 0.0625 = 0.205078
Sources cited

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

Exactly 6 heads in 10 fair coin flips

n = 10, p = 0.5, k = 6, type =

  1. C(10, 6) = 10! / (6!·4!) = 210
  2. 0.5^6 = 0.015625 0.5^4 = 0.0625
  3. P(X = 6) = 210 × 0.015625 × 0.0625 = 0.205078 ≈ 20.51%
  4. μ = np = 5, σ² = np(1−p) = 2.5, σ = 1.5811, mode = 5

Passing a 20-question MCQ by pure guessing (≥ 8 right)

n = 20, p = 0.25 (4 options), k = 8, type ≥

  1. μ = np = 5, σ² = 3.75, σ = 1.9365, mode = ⌊21 × 0.25⌋ = 5
  2. P(X ≤ 7) = Σ P(X = j), j = 0…7 = 0.898188
  3. P(X ≥ 8) = 1 − P(X ≤ 7) = 1 − 0.898188 = 0.101812 ≈ 10.18%
  4. So guessing your way to a pass is roughly a 1-in-10 shot.

Edge case — an impossible event (p = 0)

n = 8, p = 0, k = 0, type =

  1. With p = 0 every trial fails, so all probability mass sits at k = 0.
  2. P(X = 0) = (1 − 0)^8 = 1 → 100%
  3. P(X = k) = 0 for any k > 0; μ = 0, σ² = 0, σ = 0, mode = 0
  4. The tool returns this directly instead of a 0·ln(0) not-a-number.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

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.