Index / Confidence Interval

Confidence Interval Calculator

An interval estimate for a mean or a proportion, with the standard error, degrees of freedom, critical value and margin of error all shown as separate steps.

Interval Estimate

idle
n
estimate
std error
critical
df
The mean, sample standard deviation and n are computed from your data.
95% confidence interval
Lower bound
Upper bound
Margin of error
Interval width
StepWorkingValue

How to use it

Three modes. Mean from data takes your raw numbers and derives everything. Mean from summary is for when you already have x̄, s and n — from a paper, a report or another tool. Proportion handles counts: successes out of a total, for survey results, conversion rates and pass rates.

The working table lists every step in order, with the arithmetic spelled out, so the result can be reproduced by hand or checked against coursework.

What a confidence interval actually says

A sample mean is a single number. Collect a different sample and you would get a different one. A confidence interval quantifies that instability: it is a range of values that the procedure would capture the true population figure within, a stated percentage of the time.

Confidence interval for a mean
x̄ ± tα/2, n−1 × ( s ÷ √n )
Confidence interval for a proportion
p̂ ± zα/2 × √( p̂(1 − p̂) ÷ n )

Both have the same shape: a point estimate, plus or minus a critical value times a standard error. The standard error measures how much the estimate would bounce around across repeated samples; the critical value scales it to the confidence level you asked for.

The interpretation almost everyone gets wrong. A 95% confidence interval does not mean there is a 95% probability the true value lies inside this particular interval. In frequentist statistics the true population value is a fixed constant — it is either in your interval or it is not, and no probability attaches to that. What is random is the interval, because it depends on which sample you happened to draw. The correct statement: if you repeated the whole sampling procedure many times, about 95% of the intervals generated would contain the true value. If you want a statement about the probability of the parameter itself, you need a Bayesian credible interval, which is a different object.

A worked example

Twelve measurements with a mean of 23.75 and a sample standard deviation of 8.32, at 95% confidence.

  1. Standard error: 8.32 ÷ √12 = 8.32 ÷ 3.4641 = 2.4018
  2. Degrees of freedom: n − 1 = 11
  3. Critical value: t at 95% with df = 11 is 2.201
  4. Margin of error: 2.201 × 2.4018 = 5.286
  5. Interval: 23.75 ± 5.286 = 18.46 to 29.04

Note how wide that is relative to the estimate — a range of nearly eleven units around a mean of 23.75. Twelve observations simply do not pin down a mean tightly. Had n been 100 with the same standard deviation, the standard error would fall to 0.832, the critical value to about 1.984, and the interval would narrow to 22.10–25.40.

t or z — which distribution?

Use t in almost every real situation. It is the correct distribution when the population standard deviation is unknown and estimated from the same sample, which is virtually always the case. Its heavier tails widen the interval to account for that extra uncertainty.

Use z only when the population standard deviation is genuinely known in advance — rare outside textbook problems — or for proportions, where the standard error is derived from p̂ itself rather than from a separate variance estimate.

The two converge as n grows. At df = 10 the 95% t value is 2.228 against z's 1.960 — a 14% wider interval. At df = 30 it is 2.042, about 4% wider. Beyond df = 120 the difference is under 1% and immaterial.

Critical value reference

df90%95%98%99%
52.0152.5713.3654.032
101.8122.2282.7643.169
151.7532.1312.6022.947
201.7252.0862.5282.845
301.6972.0422.4572.750
601.6712.0002.3902.660
∞ (z)1.6451.9602.3262.576

This tool uses exact tabulated t values for df up to 30, linear interpolation between the standard anchors of 30, 40, 60 and 120, and the normal critical value beyond that. On any df above about 40 the interpolation error is smaller than the rounding in the fourth decimal place.

What controls the width

  • Sample size. Width scales with 1 ÷ √n, so to halve the interval you must quadruple the sample. This is the fundamental economics of survey design: precision gets expensive fast.
  • Variability. A larger standard deviation means a wider interval. Nothing can be done about this except measuring more precisely or stratifying the sample.
  • Confidence level. Going from 95% to 99% widens the interval by roughly a third. Higher confidence is not free — you buy it with precision. This is why 95% became the default: it is a reasonable compromise, not a law of nature.

Conditions for validity

For a mean: observations must be independent, and either the underlying population is roughly normal, or n is large enough (conventionally 30 or more) for the central limit theorem to make the sampling distribution of the mean approximately normal regardless. Strong skew or extreme outliers at small n break the interval.

For a proportion: observations independent, and both np̂ and n(1 − p̂) at least 10. The calculator checks this and warns you when it fails. Near p = 0 or p = 1 the normal approximation performs badly and can even produce bounds outside 0–1; use the Wilson score interval or an exact Clopper–Pearson interval instead.

Frequently asked questions

Does a 95% interval mean 95% of my data falls in it?
No, and this is a serious confusion. A confidence interval describes the precision of an estimate of the mean, not the spread of individual observations. It is typically far narrower than the data. The interval containing 95% of individual values is a prediction interval, which is a different and much wider calculation.
Why is my interval so wide?
Almost always a small sample, high variability, or both. Width is proportional to s ÷ √n, so with n = 8 and a large standard deviation the interval will be uninformative no matter what you do. A wide interval is not a failure of the method — it is the method honestly reporting that your data does not support a precise claim.
Can I use a 90% interval to get a narrower result?
You can, and the interval will be about 16% narrower, but you have not gained precision — you have lowered the standard of evidence. Choose the confidence level before seeing the data, based on the cost of being wrong. Selecting it afterwards because it produces a more convenient answer is a form of p-hacking.
Two intervals overlap. Are the groups the same?
Not necessarily, and this is a common error. Overlapping confidence intervals do not imply a non-significant difference — two 95% intervals can overlap while a two-sample test still returns p < 0.05. To compare two groups, run the appropriate two-sample test rather than eyeballing the intervals.
What if my data is badly skewed?
At n of 30 or more the central limit theorem usually rescues the interval for the mean, because the sampling distribution of the mean is much closer to normal than the raw data. At small n with strong skew, consider a bootstrap interval, or report the median with a rank-based interval instead.
How do I choose a sample size in advance?
Invert the margin of error formula: n = (z × s ÷ E)², where E is the largest margin you would accept. For a proportion with no prior estimate, use p = 0.5, which maximises the standard error and gives the most conservative n. At 95% confidence with a ±3 percentage point margin, that works out at roughly 1,067 respondents.
Is my data stored?
No. Everything runs in your browser. Nothing is transmitted to a server, logged or saved.

Next steps

The standard error this page uses comes straight from the sample standard deviation — the standard deviation calculator shows how it is built, deviation by deviation. The critical z values here (1.645, 1.960, 2.326, 2.576) are the same ones behind the z-score calculator. Before trusting an interval for the mean, check whether the mean is a sensible centre at all using the descriptive summary.