What is a confidence interval?
A confidence interval is a range of plausible values for an unknown population parameter — here, the population mean. Instead of reporting a single point estimate, it expresses the uncertainty around that estimate as a lower and an upper bound.
A 95% confidence interval, for example, means that if you repeated the same sampling procedure many times, about 95% of the intervals you build would contain the true mean. The width of the interval depends on how much your data varies, how many observations you have, and how confident you want to be.
This calculator uses the z (normal) approximation, which is appropriate when the population standard deviation is known or the sample is large enough for the Central Limit Theorem to apply.
How does the calculator work?
You provide four pieces of information:
- Sample mean (x̄) — the average of your observations.
- Standard deviation (σ) — the spread of the data; must be positive.
- Sample size (n) — the number of observations; an integer of at least 1.
- Confidence level — how sure you want to be: 90%, 95%, or 99%.
Each confidence level maps to a critical z-value:
| Confidence level | z-value |
|---|---|
| 90% | 1.645 |
| 95% | 1.960 |
| 99% | 2.576 |
The calculator returns the margin of error, the lower bound, and the upper bound.
Formulas
The standard error of the mean is:
The margin of error scales the standard error by the critical z-value:
The confidence interval for the mean is then:
Worked examples
Example 1: x̄ = 100, σ = 15, n = 36, 95%
The standard error is:
With z = 1.96 the margin of error is:
So the 95% confidence interval is [95.1, 104.9].
Example 2: x̄ = 50, σ = 10, n = 25, 99%
The standard error is:
With z = 2.576 the margin of error is:
So the 99% confidence interval is [44.848, 55.152].
Practical notes
- A higher confidence level widens the interval: being more certain that you have captured the true mean requires a larger range.
- A larger sample size narrows the interval, because the standard error shrinks with √n.
- The z approximation assumes the sampling distribution of the mean is approximately normal. For small samples with an unknown standard deviation, a t-interval is usually more accurate.
- The margin of error is symmetric, so the interval is always centered on the sample mean.