Enter a sample mean, its standard deviation and the sample size to get a confidence interval for the population mean. The calculation uses the t distribution, which is the correct choice when the population standard deviation is estimated from the sample.
The curve is the sampling distribution of the mean; the bar beneath it spans the 95% interval. Repeat the sampling many times and about 95% of the intervals built this way would contain the true mean — it is not a 95% chance that this particular one does.
Show the working, step by step
The formula
CI = x̄ ± t* × (s / √n)
Read it in three pieces:
- s / √n is the standard error — how much the sample mean itself would wobble from sample to sample.
- t* is the critical value for your confidence level with n − 1 degrees of freedom. It sets how many standard errors wide the interval reaches.
- x̄ ± centres the interval on your sample mean.
Critical t values
| df (n − 1) | 90% | 95% | 99% |
|---|---|---|---|
| 5 | 2.015 | 2.571 | 4.032 |
| 10 | 1.812 | 2.228 | 3.169 |
| 20 | 1.725 | 2.086 | 2.845 |
| 30 | 1.697 | 2.042 | 2.750 |
| 100 | 1.660 | 1.984 | 2.626 |
| ∞ (z) | 1.645 | 1.960 | 2.576 |
Notice how sharply the values fall as df rises, and how much wider a 99% interval is than a 90% one. At df = 5 the 99% critical value is twice the 90% one — small samples pay heavily for extra confidence.
A worked example
A sample of 30 measurements has a mean of 25.4 and a standard deviation of 4.2, and you want a 95% interval.
- Standard error: 4.2 ÷ √30 = 4.2 ÷ 5.4772 = 0.7668.
- Critical value at 95% with df = 29: t* = 2.0452.
- Margin of error: 2.0452 × 0.7668 = 1.568.
- Interval: 25.4 ± 1.568 = 23.83 to 26.97.
Reported properly: "mean 25.4, 95% CI [23.83, 26.97]". The width of that interval is the honest statement of how much the estimate can be trusted — a point estimate on its own hides exactly that.
Reading intervals well
- Width matters more than the point estimate. A mean of 25.4 with an interval of [25.1, 25.7] and one with [10, 41] are very different results, despite the identical centre.
- Overlapping intervals do not settle a comparison. Two groups whose intervals overlap slightly can still differ significantly; test the difference directly rather than eyeballing the bars.
- Check what an error bar represents. Published figures show SD, standard error or confidence intervals almost interchangeably, and they are wildly different widths. The caption should say; if it does not, be suspicious.
Related calculators
-
Standard error
The quantity a confidence interval is built from.
-
Standard deviation calculator
Get the s and n this calculator needs from raw data.
-
Z-score calculator
The related standardisation, for single values.
-
Variance calculator
The spread underneath the standard error.
Common questions
What does a 95% confidence interval actually mean?
It means that if you repeated the whole sampling procedure many times and built an interval this way each time, about 95% of those intervals would contain the true population mean.
It does not mean there is a 95% probability that the true mean lies inside the particular interval you calculated. That interval either contains it or it does not; the 95% describes the reliability of the method, not this one result.
Should I use t or z?
Use t when the population standard deviation is unknown and you are estimating it from the sample — which is nearly always. Use z only when σ is genuinely known in advance, which is rare outside textbook problems.
This calculator uses t. For large n the two converge: at n = 1000 the 95% t critical value is 1.9623 against z's 1.9600.
How do I make a confidence interval narrower?
Three levers, in order of usefulness. Increase n — the width shrinks with √n, so quadrupling the sample halves the interval. Reduce the underlying variability through better measurement or a more homogeneous group. Accept a lower confidence level — 90% gives a narrower interval than 95%, at the cost of being wrong more often.
What assumptions does this make?
That the data are a random sample of independent observations, and that either the underlying distribution is roughly normal or n is large enough for the central limit theorem to apply — conventionally n ≥ 30, though heavily skewed data needs more.