95% Confidence Interval Calculator
Enter your sample mean, standard deviation, and sample size to calculate the confidence interval for a population mean. The calculator uses the t-distribution for small samples (n < 30) and the z-distribution for larger ones, and it works for any confidence level from 80% to 99.9%. You get the lower and upper bounds, the margin of error, the standard error, and a full show-your-work panel.
Formula
Worked example
A researcher measures 30 participants and finds a sample mean of 172 cm and a standard deviation of 15 cm. The standard error is 15/sqrt(30) = 2.739. At 95% confidence with df = 29, the critical value is t* = 2.045. The margin of error is 2.045 x 2.739 = 5.60. The 95% confidence interval is 172 +/- 5.60, or from 166.40 to 177.60.
What is a confidence interval?
A confidence interval (CI) is a range of values, calculated from your sample data, that is likely to contain the true population parameter. When researchers report a "95% confidence interval," they mean that if the same sampling procedure were repeated many times, roughly 95% of those intervals would capture the true mean. The interval does not say the true mean has a 95% probability of being inside this particular interval - the true mean is fixed, not random; it is either inside or it is not. What varies from sample to sample is the interval itself. The width of the interval is controlled by three things: sample size (larger n narrows it), standard deviation (less spread narrows it), and confidence level (lower confidence narrows it).
When to use t vs. z
This calculator uses the t-distribution for all sample sizes, which is always the correct choice when the population standard deviation is unknown (which is nearly always). For large samples (n >= 120) the t critical value converges to the z critical value, so the distinction becomes negligible. The key rule is: if you are working from a sample standard deviation rather than a known population standard deviation, use t. The degrees of freedom equal n - 1, reflecting the one constraint imposed by estimating the mean from the same data. For samples below about 10, the interval widens noticeably; below about 5 it widens dramatically, which is the t-distribution warning you that small samples carry high uncertainty.
How sample size affects the interval
The standard error (s divided by the square root of n) is the single biggest lever you can pull. Because of the square root, you must quadruple the sample size to halve the standard error. Doubling from n = 25 to n = 100 cuts the standard error in half and, for a fixed confidence level, roughly halves the margin of error. The chart on this page shows exactly how the bounds tighten as n increases from 5 to 200 for your data. Collecting more data is nearly always more cost-effective than increasing precision in other ways, because those other ways (higher measurement accuracy, tighter experimental controls) tend to reduce the standard deviation, whose effect on the margin of error is only linear, not square-root.
Reading and reporting confidence intervals
When you report a result, write the confidence interval alongside the point estimate, for example: "The mean response time was 340 ms (95% CI: 312 to 368 ms)." Always state the confidence level, since intervals at 80%, 95%, and 99% tell very different stories. A narrow interval at 95% confidence signals a precise, well-powered study. A wide interval at 90% confidence should prompt caution. Overlapping confidence intervals from two groups do not prove the groups are the same - that requires a significance test - but non-overlapping 95% CIs do suggest a statistically significant difference at approximately the 5% level.
Common confidence levels and critical values
| Confidence level | z* (large n) | Meaning |
|---|---|---|
| 80% | 1.282 | 20% chance the interval misses the true mean |
| 85% | 1.440 | 15% chance the interval misses the true mean |
| 90% | 1.645 | 10% chance the interval misses the true mean |
| 95% | 1.960 | 5% chance the interval misses the true mean |
| 99% | 2.576 | 1% chance the interval misses the true mean |
| 99.9% | 3.291 | 0.1% chance the interval misses the true mean |
z* values assume large samples (n >= 30). For small samples the t-distribution produces slightly larger critical values.
Frequently asked questions
What does a 95% confidence interval mean?
It means the procedure used to construct the interval will capture the true population mean in approximately 95% of repeated samples. For any one specific interval you have computed, the true mean is either inside or outside - the 95% refers to the long-run success rate of the method, not the probability for a single interval.
Why does the calculator use the t-distribution instead of z?
When the population standard deviation is unknown (the typical case), the t-distribution correctly accounts for the added uncertainty of estimating it from the sample. As sample size grows, the t critical value approaches the z critical value, so for n >= 120 there is essentially no difference. Using z on small samples underestimates the critical value and makes your interval artificially narrow.
How do I reduce my margin of error?
The most powerful lever is sample size: the margin of error shrinks proportionally to 1/sqrt(n), so quadrupling your sample size halves the margin of error. Reducing within-group variability (tighter study protocol, matched samples, within-subjects design) lowers the standard deviation and therefore the standard error. Accepting a lower confidence level (say 90% instead of 95%) also narrows the interval, but at the cost of missing the true mean more often.
Can I use this for a proportion instead of a mean?
No - this calculator is for a continuous mean. Proportions use a different formula: the standard error of a proportion p is sqrt(p(1-p)/n), and the Wilson or Agresti-Coull intervals are preferred over the simple Wald formula, especially when p is near 0 or 1 or n is small. Use a dedicated proportion confidence interval calculator for that case.
What sample size do I need to achieve a target margin of error?
Rearrange the formula: n = (z* x s / ME)^2, where ME is your target margin of error. For example, to get a margin of error of 5 units at 95% confidence with a standard deviation of 20, you need n = (1.96 x 20 / 5)^2 = (7.84)^2 = about 62 observations. Because this formula uses the z approximation and the standard deviation is estimated, round up and consider adding 10-20% as a buffer for attrition.
Do confidence intervals assume normality?
They rely on the Central Limit Theorem, which says the sampling distribution of the mean approaches normality regardless of the underlying distribution as n grows. For n >= 30 the approximation is good in most practical situations. For smaller samples, the t-interval is still valid if the data themselves are approximately normal. If the data are highly skewed or contain heavy-tailed outliers with a small n, consider bootstrap confidence intervals instead.