Confidence Interval Calculator

In short: a confidence interval turns a single estimate into an honest range. A sample mean of 52 with a standard deviation of 12 from 36 observations gives a 95 percent interval of 47.94 to 56.06 — the mean, plus or minus a 4.06 margin of error. For a proportion, 120 of 200 gives 53.1 to 66.5 percent by the Wilson method. Wider samples narrow the range; nothing else does.

How the interval is built

Every confidence interval on this page has the same skeleton: estimate +/- critical value x standard error. The standard error measures how much the estimate itself would wobble from sample to sample: for a mean it is s / sqrt(n), for a proportion sqrt(p(1-p) / n). The critical value comes from the confidence level: 1.645 for 90 percent, 1.96 for 95 percent, 2.576 for 99 percent on the normal curve. Asking for more confidence widens the interval — a 99 percent interval must cover more possibilities than a 95 percent one — and quadrupling the sample size halves the standard error, which is the only honest way to buy precision.

For a mean from a small sample, the normal critical value is replaced by the larger t value, which prices in the extra uncertainty of estimating the standard deviation from the same small sample. With 36 observations the difference is modest (2.030 instead of 1.96); with 8 observations it is large (2.365). Use the t version whenever the standard deviation comes from your sample — which is nearly always — and the z version only when the population standard deviation is genuinely known from outside the sample, or the sample is large enough that the two agree to the precision you need.

Proportions: why Wilson beats Wald

The textbook proportion interval (Wald) takes p +/- z x sqrt(p(1-p)/n). It is simple, and for large samples with p near the middle it is fine — 120 of 200 gives 0.532 to 0.668. But it misbehaves exactly where proportions get interesting: small samples, or p near 0 or 1. It can produce intervals that dip below 0 or above 1, and its true coverage can fall far below the stated 95 percent. The Wilson score interval fixes this by centring the interval slightly toward 0.5 and shrinking it asymmetrically; for the same 120 of 200 it gives 0.531 to 0.665, and for 3 successes in 20 trials it gives a sane 0.052 to 0.360 where Wald claims 0.000 to 0.307 and clips at zero. This page shows both; quote the Wilson figure when n is small or the proportion is extreme.

What the interval means deserves one careful sentence, because it is so often bent. A 95 percent confidence interval is built by a method that captures the true value in 95 percent of samples. It is not, strictly, "a 95 percent probability that the true value is in this interval" — the true value is fixed, and this particular interval either contains it or not. In practice everyone uses the interval as the range of plausible values, and that working reading is fine; just do not let anyone turn it into a probability about a single study's result with a straight face.

A worked example

Thirty-six students average 52 marks with a standard deviation of 12. Standard error: 12 / sqrt(36) = 2. The sample is small enough to use t with 35 degrees of freedom: 2.030 at 95 percent. Margin of error: 2.030 x 2 = 4.06. Interval: 47.94 to 56.06. Now quadruple the sample to 144 with the same mean and spread: the standard error halves to 1, t falls to about 1.977, and the interval tightens to 50.02 to 53.98 — the same data quality, a quarter of the width of uncertainty per unit of effort spent on sample size. That square-root law is why surveys of 1,000 people carry margins of error near 3 points, and why pushing to 10,000 respondents buys so little extra.

Frequently asked questions

What does a 95 percent confidence interval mean?

It is a range built by a method that would contain the true population value in 95 percent of repeated samples. Practically, read it as the range of values consistent with your data: a mean of 52 with a 95 percent interval of 47.9 to 56.1 means the data sit comfortably with a true mean anywhere in that span, and awkwardly with values outside it. It does not mean 95 percent of the data fall inside the interval — that is a different, much wider range.

How does sample size affect the interval?

Through the square root in the standard error. Doubling the sample narrows the interval by about 29 percent; quadrupling it halves the interval; you need one hundred times the sample to make the interval ten times narrower. This is why most surveys stop around 1,000 to 2,000 respondents: beyond that, each extra point of precision costs enormously more data than the last.

Should I use z or t for a mean?

Use t when the standard deviation was calculated from your sample — almost always. The t distribution has heavier tails that honestly price the extra uncertainty, and its critical value is larger than z, especially for small samples: 2.306 at 8 degrees of freedom against 1.96 for z at 95 percent. Use z only when the population standard deviation is known independently, or when n is large (past roughly 100) and the two have converged anyway.

Why are there two intervals for a proportion?

The Wald interval is the simple textbook formula; the Wilson interval is the one statisticians recommend in practice. Wald can dip below 0 or above 1 and can undercover badly for small samples or proportions near the edges. Wilson stays inside 0 to 1, centres better, and keeps close to its stated coverage. For large samples with a middling proportion they nearly agree — 120 of 200 gives (0.532, 0.668) Wald and (0.531, 0.665) Wilson — so the choice matters most exactly when data are scarce.

What margin of error should I aim for?

It depends on the decision the number feeds. A poll calling an election needs a margin under about 2 points; a product team checking whether satisfaction moved can live with 5. Work backwards: pick the margin you need, then solve for n. For a proportion at 95 percent confidence with the worst case p = 0.5, n = (1.96 / margin) squared x 0.25 — a 3-point margin needs about 1,068 responses, a 1-point margin about 9,604.

Related tools

Formulas checked on 24 November 2026 against hand-worked examples. Everything is calculated in your browser — nothing you type is sent anywhere.