Confidence Interval Calculator
A sample mean is never the whole story — another sample would give a slightly different average. A confidence interval turns one sample into a range of plausible values for the true population mean, with a stated level of confidence. A 95% confidence interval of [94.12, 105.88] means the data is consistent with any population mean in that range, and values outside it are much less consistent with what you observed.
Enter your sample mean, standard deviation and sample size, pick a confidence level, and choose a z-interval (population standard deviation known, or a large sample) or a t-interval (small sample, standard deviation estimated from the data). The calculator shows the interval, the margin of error and the critical value it used.
95% confidence interval
How It Works
A confidence interval for a mean is built from three ingredients:
Interval = sample mean ± margin of error, where margin of error = critical value × standard error and standard error = SD / √n.
The standard error measures how much sample means bounce around: it shrinks as the sample grows, because the average of more observations is steadier. Doubling the sample size does not halve the standard error — it divides it by √2, about 1.41. To halve the margin of error you need four times the data.
The critical value depends on the confidence level and on whether you use the z or the t distribution. For a z-interval the standard values are 1.6449 (90%), 1.96 (95%) and 2.5758 (99%). For a t-interval the critical value also depends on the degrees of freedom, df = n − 1: with 9 degrees of freedom the 95% value is 2.2622, with 24 it is 2.0639, and with 29 it is 2.0452. The t values are always larger than the z value at the same confidence level, because estimating the standard deviation from a small sample adds uncertainty — the t distribution has heavier tails. As the sample grows, the t value closes in on the z value; above 30 degrees of freedom the difference is small enough that this calculator uses the z value.
Which one should you use? The z-interval when the population standard deviation is genuinely known, or when the sample is large (roughly n ≥ 30). The t-interval when the sample is small and the standard deviation is estimated from the sample itself — which is the usual situation in practice.
Worked Example
A sample of 25 students has a mean score of 100 with a standard deviation of 15. The standard error is 15 / √25 = 15 / 5 = 3. For a 95% z-interval the critical value is 1.96, so the margin of error is 1.96 × 3 = 5.88 and the interval is 100 ± 5.88 = [94.12, 105.88].
Now take a smaller sample of 10 with the same mean and standard deviation, and use the t-interval. The standard error is 15 / √10 = 4.7434. With 9 degrees of freedom the 95% t value is 2.2622, so the margin of error is 2.2622 × 4.7434 = 10.73 and the interval is 100 ± 10.73 = [89.27, 110.73] — much wider, because the small sample leaves more uncertainty about both the mean and the spread.
Assumptions
- Random sampling. The interval assumes your sample is a random sample from the population you want to describe. A biased sample gives a precisely wrong interval.
- Roughly normal data, or a large sample. The t-interval assumes the underlying population is approximately normal when the sample is small. With a large sample the central limit theorem makes the interval valid even for skewed data.
- The t-interval estimates the SD from the sample. That extra uncertainty is exactly why the t critical value is larger than the z value. If you genuinely know the population SD, the z-interval is the right choice at any sample size.
- Degrees of freedom above 30 use the z value. At df = 30 the 95% t value is 2.0423 against a z of 1.96 — a difference of about 4% in the margin — and it only shrinks from there, so the calculator switches to z for df > 30.
- SD = 0 collapses the interval to the mean. If every observation is identical there is no uncertainty to measure, so the interval is a single point — shown as a result, not an error.
- Confidence is about the method, not this interval. 95% confidence means about 95% of intervals built this way contain the true mean. It is not a 95% probability that this particular interval contains it.
Sources: No external data is used on this page — every figure is calculated from the values you enter. The t critical values (df 1–30 at 90%, 95% and 99%) are the standard published t-table values; z critical values are 1.6449, 1.96 and 2.5758. Custom confidence levels use Acklam's inverse-normal approximation (z) and bisection on the t distribution (t). Last reviewed: 15 November 2026.
Built and tested by SumKitTool — see how we check our numbers.
How to Use This Calculator
Enter the sample mean, the standard deviation and the sample size, then pick the confidence level and the interval type. The headline result is the interval itself; the table shows the standard error, the critical value used, the margin of error and both bounds, plus a plain-English interpretation.
Try the worked example: mean 100, SD 15, n = 25 at 95% gives [94.12, 105.88] as a z-interval. Switch to the t-interval and change n to 10 to see [89.27, 110.73] — the same data, honestly wider, because a small sample says less.
Tips and Practical Advice
To narrow an interval, collect more data — but know the price. Halving the margin of error needs four times the sample size, because the standard error shrinks with the square root of n. Going from n = 25 to n = 100 halves the margin; going to n = 400 halves it again.
Do not pick the confidence level after seeing the result. 90% gives a narrower interval than 95%, and 99% a much wider one — choose the level before you calculate, based on how much certainty the decision needs.
If two intervals overlap, that does not automatically mean the two groups are the same — overlapping confidence intervals can still hide a real difference. Comparing two means properly needs a two-sample test, not an eyeball comparison of intervals.
Frequently Asked Questions
What is a 95% confidence interval?
It is a range of values, built from your sample, that is consistent with the data at the 95% confidence level. The precise meaning is about the method: if you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true population mean. It is not a 95% probability that this particular interval contains the true mean — the true mean is fixed, and the interval is what varies.
When should I use a t-interval instead of a z-interval?
Use the t-interval when your sample is small (roughly under 30) and the standard deviation is estimated from the sample itself — that is the usual situation. Use the z-interval when the population standard deviation is genuinely known, or when the sample is large. For large samples the two agree closely: at 30 degrees of freedom the 95% t value is 2.0423 against a z of 1.96.
Why is the t-interval wider than the z-interval?
Because a small sample leaves two kinds of uncertainty: about the mean, and about the spread. The t distribution has heavier tails than the normal distribution to account for the estimated standard deviation, so its critical values are larger — 2.2622 instead of 1.96 at 95% with 9 degrees of freedom. As the sample grows, the t value closes in on the z value and the extra width disappears.
How do I make my confidence interval narrower?
Collect more data: the margin of error shrinks with the square root of the sample size, so quadrupling the sample halves the margin. You can also accept a lower confidence level — a 90% interval is narrower than a 95% one — but that trades certainty for precision. You cannot change the standard deviation of the population, so sample size and confidence level are the two levers you actually control.
Last updated: