Beta Distribution Calculator
The beta distribution lives entirely between 0 and 1, which makes it the natural home for an unknown proportion: a conversion rate, a defect rate, a batting average. Give it two shape numbers, α and β, and this tool returns the density at a point, the probability of any region, the quantiles behind a credible interval, and the mean, variance and mode, with the curve shaded and the R code to match.
-
How this is computed
pbeta() is; going backwards from a probability to a value inverts it, which is qbeta(). Both agree with R to at least nine significant digits here.
✓ No data leaves your browser
✓ Verified against R's dbeta(), pbeta() and qbeta()
✓ Free, no sign-up
Why the beta distribution owns the 0-to-1 interval
Most distributions you meet first are about counts or quantities. The beta is about a fraction.
A normal distribution runs from minus infinity to plus infinity, so it will happily tell you a conversion rate might be 1.4 or negative 0.2. Neither is a thing. A proportion has to land between 0 and 1, and the beta density is zero outside that interval by construction: its formula is xα-1(1-x)β-1, normalised by the beta function B(α, β). Feed it any α and β above zero and you get a curve whose entire area sits on 0 to 1.
That single fact is why the beta turns up wherever an unknown probability does. The thing you are uncertain about is itself a probability, and the beta is a probability distribution over probabilities.
Alpha and beta are pseudo-counts
The two shape numbers are not abstract dials. They count evidence.
Start from total ignorance about a rate: that is Beta(1, 1), flat, every proportion equally plausible. Now watch 100 visitors and see 30 convert. Add the successes to α and the failures to β and you hold Beta(31, 71). So α carries 1 plus your successes and β carries 1 plus your failures, and the mean, α/(α+β) = 0.304, sits essentially at the observed 30%, nudged a hair toward the middle by that flat prior.
Reading them this way makes the shape obvious. Raising α slides the curve right, raising β slides it left, and raising both narrows it, because a bigger pile of evidence leaves less room for doubt. Beta(3, 7) and Beta(31, 71) share a mean near 0.3, but the second is far narrower: 100 observations beat 8.
| Shapes | Shape of the curve | Reads as |
|---|---|---|
Beta(1, 1) | Flat | No evidence at all: the uniform prior |
Beta(2, 8) | Skewed toward 0 | A rare event: 1 success in 8 tries |
Beta(31, 71) | A tight bump near 0.3 | 30 successes, 70 failures |
Beta(0.5, 0.5) | Spikes at both ends | Belief the rate is near 0 or near 1, not in between |
Beta(500, 500) | Almost a normal curve | Overwhelming evidence of a 50/50 rate |
The conjugacy hook: beta prior plus binomial data is a beta posterior
This is the property that made the beta famous, and it is simpler than it sounds.
Suppose your belief about a rate is Beta(a, b) and you then run a binomial experiment: s successes and f failures. Bayes' theorem says multiply the prior by the likelihood and renormalise, which in general means an integral you cannot do by hand. For this pair, the integral collapses. The answer is just:
Beta(a, b) prior + s successes and f failures → Beta(a + s, b + f) posterior.
You update your beliefs by adding. No integration, no simulation, no sampler. That is what conjugate means: the prior and the posterior belong to the same family, so the data only has to move the parameters. It is why the beta-binomial pair is the first worked example in nearly every Bayesian course, and why the posterior preset above is really just Beta(1+30, 1+70).
Set the mode to Quantile with a central band of 95% and the two values you get back are the endpoints of the credible interval: given this posterior, there is a 95% probability the rate lies between them. That is the sentence people wrongly wish a confidence interval said, and here it is literally true. For the priors side of this, see conjugacy and choosing priors; for the wider picture, Bayesian statistics in R.
Each mode, and the R function behind it
Areas use pbeta(), the height of the curve is dbeta(), and working back from a probability is qbeta().
| You want | The region | In R |
|---|---|---|
| Height of the curve at x | f(x) | dbeta(x, shape1, shape2) |
| Area below a value | P(X ≤ x) | pbeta(x, shape1, shape2) |
| Area above a value | P(X > x) | pbeta(x, shape1, shape2, lower.tail = FALSE) |
| Area between two values | P(a ≤ X ≤ b) | pbeta(b, ...) - pbeta(a, ...) |
| The value for a probability | find x | qbeta(p, shape1, shape2) |
| A 95% credible interval | find both ends | qbeta(c(0.025, 0.975), shape1, shape2) |
One caution the density mode makes visible: dbeta() returns a density, not a probability. It can exceed 1, and when α is below 1 it runs to infinity at 0. The curve still encloses an area of exactly 1, which is why a spike that tall is not a contradiction. Only areas are probabilities.
Frequently asked questions
What is the beta distribution used for?
It lives on 0 to 1, exactly the range a proportion can take, which makes it the natural distribution for an unknown probability: a conversion rate, a click-through rate, a batting average, a defect rate. In Bayesian work it is the standard prior and posterior for a rate you are trying to learn.
What do alpha and beta mean?
They are pseudo-counts. From a uniform Beta(1,1) start, α is 1 plus your successes and β is 1 plus your failures, so Beta(31,71) is what 30 successes and 70 failures leave you holding. Raising α pushes the curve right, raising β pushes it left, and raising both tightens it.
Why is a beta prior used with binomial data?
Because the beta is the conjugate prior for the binomial. A Beta(a,b) prior plus s successes and f failures gives a Beta(a+s, b+f) posterior, so the update is plain addition instead of an integral. Prior and posterior stay in the same family.
What are the mean, variance and mode?
The mean is α/(α+β) and the variance is αβ/[(α+β)2(α+β+1)]. The mode is (α-1)/(α+β-2) when both shapes are above 1. Two cases have no single mode, and this calculator says so rather than inventing one: Beta(1,1) is flat, and when both shapes are below 1 the curve is bimodal, piling up at 0 and at 1.
Is Beta(1,1) really the uniform distribution?
Yes, exactly. Its density is 1 everywhere on 0 to 1 and its CDF is the straight line P(X ≤ x) = x. Load the Uniform preset and you will see the flat curve and a probability that simply equals your cutoff. That is why it is the standard flat prior.
Can the density be greater than 1?
Yes, and it often is. A density is a height, not a probability; only the area under it is a probability. Beta(31,71) peaks near 8.8, and when α is below 1 the height at 0 is infinite. The total area is still exactly 1 in every case.
Does this calculator match R?
Yes. It is checked against R's dbeta(), pbeta() and qbeta() over 42 cases covering the uniform special case, the spike when α is below 1, near-normal shapes at α=β=500, the boundaries at 0 and 1, and quantiles out at 0.001 and 0.999. The worst disagreement is about 1 part in 6 billion.