Bernoulli Distribution Calculator

StatisticsLast updated: August 22, 2026

The Bernoulli distribution describes a single trial with only two outcomes: success (X = 1) and failure (X = 0). The whole distribution is defined by one parameter, the success probability p. A coin toss, whether an advertisement is clicked, whether a patient responds to treatment, whether a manufactured part comes out defective — each is a Bernoulli trial. Despite its simplicity it is the most basic building block of probability theory: the binomial, geometric, and negative binomial distributions are all built by stacking Bernoulli trials.

From p alone, this calculator returns every summary measure of the Bernoulli distribution (mean, variance, standard deviation, skewness, excess kurtosis, mode, median, odds, and entropy). It then shows the Binomial(n; p) distribution that arises when the same trial is repeated n independent times: the total number of successes has mean n·p and variance n·p(1−p), and the probability of any given number of successes is computed directly. Two bar charts support the results.

A value between 0 and 1. For example 0.5 for a fair coin, or 0.3 for a 30% conversion rate.
How many times the same trial is repeated. The total number of successes follows Binomial(n; p).
For how many successes out of n trials should the probability be computed?

Bernoulli Distribution Formulas

Mass function:     P(X = x) = pˣ·(1 − p)^(1−x),  x ∈ {0, 1}
Explicit form:     P(X = 1) = p ,  P(X = 0) = 1 − p
Mean:              E(X) = p
Variance:          Var(X) = p·(1 − p)
Standard dev.:     σ = √[p(1 − p)]
Skewness:          γ₁ = (1 − 2p) / √[p(1 − p)]
Excess kurtosis:   γ₂ = [1 − 6p(1 − p)] / [p(1 − p)]
Odds:              odds = p / (1 − p)
Entropy:           H = −p·log₂p − (1 − p)·log₂(1 − p)   (bits)
Sum of n trials:   X₁ + … + Xₙ ~ Binomial(n; p)
Binomial mass:     P(X = k) = C(n, k)·p^k·(1 − p)^(n−k)
Binomial moments:  E = n·p ,  Var = n·p(1 − p)

The Bernoulli distribution has a single parameter: once p is known, the entire distribution is known. The relation Var = μ(1 − μ) between mean and variance is the basis of logistic regression and of the binomial variance function in generalized linear models.

How to Calculate

  1. Enter the success probability of a single trial (p); it must lie between 0 and 1 (divide a percentage by 100).
  2. State how many times the same trial is repeated independently (n).
  3. Write the number of successes (k) whose probability you are interested in within those n trials.
  4. Read the mean, variance, skewness, kurtosis, and entropy in the Bernoulli section; all of them depend on p alone.
  5. In the binomial section, verify that n·p and n·p(1−p) are exactly n times the Bernoulli measures.
  6. Compare the two bar charts: as the two-bar Bernoulli mass is repeated, it turns into the bell-shaped binomial mass.

Worked Examples

A 30% conversion rate with 10 visitors

If a page converts at 0.3, then for a single visitor the mean is 0.3, the variance 0.21, and the standard deviation 0.4583; with a skewness of 0.8729 the distribution is right-skewed. Across 10 independent visitors the expected number of conversions is 3 and the variance is 2.1. The probability of exactly 3 conversions is 0.266828 (26.68%), and the probability of at least one conversion is 0.971752.

P(X = 1) — success: 0.3000 · P(X = 0) — failure: 0.7000 · Mean (expected value): 0.3000

A fair coin: p = 0.5 and 20 tosses

At p = 0.5 the Bernoulli distribution is symmetric: the skewness is 0, the variance takes its largest possible value of 0.25, and the entropy is exactly 1 bit. Over 20 tosses the expected number of heads is 10, the variance is 5, and the standard deviation is 2.2361. The probability of exactly 10 heads is 0.176197 — the most likely outcome, and still below 20%.

P(X = 1) — success: 0.5000 · P(X = 0) — failure: 0.5000 · Mean (expected value): 0.5000

A rare event: p = 0.05 and 50 trials

On a production line with a defect rate of 0.05, a single part has a variance of only 0.0475 and a skewness of 4.1295 (strongly right-skewed). In a batch of 50 parts the expected number of defects is 2.5; the probability of exactly 2 defective parts is 0.261101, and the probability of at least one defect is 0.923055.

P(X = 1) — success: 0.0500 · P(X = 0) — failure: 0.9500 · Mean (expected value): 0.0500

Frequently Asked Questions

What is the difference between the Bernoulli and the binomial distribution?
Bernoulli models a single trial, while the binomial models the total number of successes in n independent trials. Mathematically Bernoulli(p) = Binomial(1; p). The sum of n independent Bernoulli variables follows Binomial(n; p), which is why the mean rises from p to n·p and the variance from p(1−p) to n·p(1−p). One coin toss is Bernoulli; the number of heads in ten tosses is binomial.
Why is the variance largest at p = 0.5?
The expression Var(X) = p(1 − p) is an inverted parabola in p, so it peaks at p = 0.5 with a value of 0.25; as p approaches either extreme (0 or 1) the outcome becomes more certain and the variance falls to zero. This is why sample size calculations for a proportion assume p = 0.5 when p is unknown: taking the largest variance keeps the required sample on the safe side.
What does the entropy of a Bernoulli distribution mean?
Entropy measures the uncertainty in the outcome of a single trial in bits. Uncertainty is highest at p = 0.5, where the entropy is exactly 1 bit — one bit is needed to report the result. As p moves toward the extremes the outcome becomes predictable and the entropy falls to zero; at p = 0.05 it is only 0.286 bits. The same measure is used in information theory and in the information gain calculation of decision trees.
How do I do Bernoulli calculations in Excel, R, and Python?
Bernoulli needs no dedicated function: P(X=1) = p and P(X=0) = 1−p can be written directly. For the binomial extension, Excel's =BINOM.DIST(k, n, p, FALSE) gives the exact probability and TRUE gives the cumulative one. R uses dbinom(k, n, p) and pbinom(k, n, p), and Python uses scipy.stats.binom.pmf(k, n, p). The R call rbinom(m, 1, p) generates m Bernoulli trials directly.
How should I interpret the skewness and kurtosis values?
Skewness is computed as (1 − 2p)/√[p(1−p)]: it is positive (right-skewed) when p < 0.5, negative when p > 0.5, and exactly zero at p = 0.5. Excess kurtosis is at its smallest possible value of −2 at p = 0.5; no distribution is flatter than one placing equal mass on two points. As p approaches the extremes both measures grow quickly: at p = 0.05 the skewness is 4.13 and the kurtosis 15.05.
When is the Bernoulli model not appropriate?
It is not appropriate when the trials are not independent or when the success probability changes from trial to trial. If you draw without replacement from a finite population, p changes at every draw and the hypergeometric distribution is required. Repeated measurements on the same person, clustered data, and trials with a learning effect also break independence; such cases call for mixed-effects logistic models or overdispersion-aware models such as the beta-binomial.