What is a confidence interval?
A confidence interval is a range of plausible values for an unknown population parameter, built from sample data. When the parameter is a population mean, the interval is centered on the sample mean and extends a margin of error in each direction. A 95% confidence interval of 20.6 ± 0.887 means the estimate runs from 19.713 to 21.487.
The confidence level describes the method, not one particular interval. If you drew many random samples and built a 95% interval from each, about 95% of those intervals would contain the true mean. Any single interval either contains it or does not; we simply do not know which. Saying there is a 95% chance that the true mean is inside this specific interval is a common but technically inaccurate shorthand.
The formula
- X̄ is the sample mean.
- Z is the z-value for the chosen confidence level.
- σ is the population standard deviation (or the sample standard deviation s for large samples).
- n is the sample size.
The quantity σ / √n is the standard error of the mean. Multiplying it by Z gives the margin of error.
Common z-values
| Confidence level | Z |
|---|---|
| 80% | 1.2816 |
| 85% | 1.4395 |
| 90% | 1.6449 |
| 95% | 1.9600 |
| 99% | 2.5758 |
| 99.5% | 2.8070 |
| 99.9% | 3.2905 |
The calculator accepts any confidence level, not only those in the table, and computes the exact z-value from the normal distribution.
Worked example
A sample of 50 commuters reports an average trip of 20.6 minutes with a standard deviation of 3.2 minutes. For 95% confidence, Z = 1.96. The standard error is 3.2 / √50 ≈ 0.4525, so the margin of error is 1.96 × 0.4525 ≈ 0.887 minutes. The interval is 20.6 ± 0.887, or 19.713 to 21.487 minutes. The margin is about 4.3% of the mean.
What changes the width of the interval
- Confidence level: higher confidence requires a larger Z, so the interval widens. Going from 95% to 99% widens it by about 31%.
- Sample size: the margin shrinks with √n. Quadrupling the sample halves the margin of error.
- Variability: a larger standard deviation produces a wider interval. Reducing measurement noise narrows it.
Small samples
The z-based interval assumes either a known population standard deviation or a sample large enough (a common rule of thumb is 30 or more) that the sample standard deviation is a reliable stand-in. For small samples with an estimated standard deviation, a t-distribution with n − 1 degrees of freedom gives a wider and more honest interval. The calculator flags samples under 30 so you can decide whether that adjustment is needed.
Confidence intervals and hypothesis tests
A 95% confidence interval and a two-sided test at the 5% significance level tell the same story: if a hypothesized mean falls outside the interval, the test would reject it. Intervals are often more informative than a bare p-value because they also show the size and precision of the estimate.
Reporting a confidence interval
A clear report gives the estimate, the interval and the confidence level together, for example: "Average commute time was 20.6 minutes (95% CI 19.7 to 21.5, n = 50)." Readers can then judge both the size of the effect and how precisely it was measured. Avoid reporting the margin of error alone, because without the confidence level it cannot be interpreted. When comparing two groups, look at the interval for the difference between them rather than checking whether the two separate intervals overlap, which is a less sensitive test.
Common misreadings
A confidence interval for the mean says nothing about where individual values fall: most single observations lie well outside it. Use a prediction interval or the standard deviation for that. Also remember the interval only accounts for random sampling error, not bias from a poorly chosen sample.