Confidence Interval Calculator
Enter a sample mean, standard deviation, and sample size to get the confidence interval for the population mean. Small samples (n < 30) automatically use the t-distribution; larger ones use z — the method line tells you which was applied.
Steps & interpretation
What a confidence interval means
A 95% confidence interval is a range built so that, if you repeated the sampling many times, about 95 of every 100 intervals constructed this way would contain the true population mean. It is not a 95% chance that the truth is inside this one interval — the truth is fixed; the interval is what varies. Width is driven by three levers: more confidence widens it, more data narrows it (by √n), and noisier data widens it. Below n = 30 the sample SD is itself shaky, so the t-distribution’s fatter tails add honest extra width.
How it’s calculated
CI = x̄ ± crit × s ÷ √n. For n < 30 the critical value is tα/2, n−1, computed from the Student t-distribution via the regularized incomplete beta function; for n ≥ 30 it is the normal zα/2 (1.96 at 95%). This assumes an approximately normal population or a large enough sample for the central limit theorem.
Results update as you type and are for education, not professional advice — double-check any number that matters.
Worked example
A sample of n = 25 with mean 22.8 and SD 2.7 at 95% confidence: SE = 2.7 ÷ √25 = 0.54. Since n < 30, the critical value is t0.025, 24 = 2.0639, so the margin is 2.0639 × 0.54 = 1.1145 and the interval is 21.686 to 23.914. Using z (1.96) instead would give a narrower ±1.058 — slightly overconfident for a sample this small.
Common mistakes
- Saying “95% probability the true mean is in this interval” — the correct reading is about the long-run success rate of the method.
- Using z with tiny samples — at n = 5, t (2.776) is 42% wider than z (1.96) for good reason.
- Entering the population SD as if it were known — if s came from the same sample, the t-method is the honest choice.
Where it is used
- Reporting survey and experiment results with error bars.
- Lab and quality measurements — interval for a true process mean.
- Comparing whether two group means plausibly differ.
Frequently asked questions
When should I use t instead of z?
Use t whenever the population SD is unknown and estimated from the sample — which is almost always. The difference only matters for small samples: by n = 30, t (2.045) is within 4% of z (1.96), which is why 30 is the traditional cutoff this calculator applies automatically.
What exactly does 95% confident mean?
It describes the procedure, not this single interval: across many repeated samples, about 95% of intervals built this way would capture the true mean. Any one interval either contains it or does not.
How can I make my interval narrower?
Collect more data (width shrinks with √n — quadrupling n halves the width), reduce measurement noise, or accept a lower confidence level. Moving from 95% to 90% narrows the example interval from ±1.11 to ±0.92.
Does this work for proportions?
No — this page is for means. A proportion interval uses p̂ ± z√(p̂(1−p̂)/n); our sample size calculator handles the proportion side of that math.
What assumptions am I making?
That observations are independent and either the population is roughly normal or n is large enough for the central limit theorem. Heavy skew or outliers with small n can make the stated coverage optimistic.