Math · Statistics
Confidence interval calculator for a mean.
Enter a sample mean, standard deviation and sample size. You get the confidence interval, margin of error, standard error and the t value used. Everything runs in your browser.
A sample of 25 with mean 52 and standard deviation 8 has a 95% confidence interval for the mean of 48.70 to 55.30: the standard error is 8 / √25 = 1.60, the t value for 24 degrees of freedom is 2.064, and the margin of error is ±3.30.
Sample summary
Your result
Fill the form and press Calculate.
The formula
NIST gives the confidence limits for a mean as x̄ ± t1−α/2, N−1 · s / √N, where x̄ is the sample mean, s the sample standard deviation, N the sample size and t1−α/2, N−1 the 100(1 − α/2) percentile of the t distribution with N − 1 degrees of freedom. The confidence coefficient is 1 − α. s / √N is the standard error of the mean, and the t term times the standard error is the margin of error. If the population standard deviation is known, the normal value z1−α/2 replaces t.
Worked example
Mean 52, s = 8, N = 25, 95%: standard error = 8 / 5 = 1.60. Degrees of freedom = 24 and t0.975, 24 = 2.0639, so the margin of error is 2.0639 × 1.60 = 3.30 and the interval is 52 ± 3.30 = 48.70 to 55.30. At 99% the t value is 2.7969, giving 47.52 to 56.48. Using z = 1.960 instead of t would give a slightly too narrow 48.86 to 55.14. With N = 100 the 95% interval narrows to 50.41 to 53.59, because the standard error falls to 0.80 and t to 1.984.
What the interval means
NIST is explicit that a 95% confidence interval does not mean there is a 95% probability that the interval contains the true mean. The confidence level describes the method: in the long run about 95% of intervals built this way from repeated samples contain the true mean. The interval narrows as the sample grows and widens with a larger standard deviation. It assumes a random sample from a roughly normal population, or a sample large enough for the mean to be roughly normal.
Sources, opened 8 October 2026: NIST/SEMATECH e-Handbook, 1.3.5.2 Confidence Limits for the Mean (the formula, the interpretation of the confidence coefficient, effect of N and s); NIST/SEMATECH e-Handbook, 1.3.6.7.2 Critical Values of the Student's t Distribution (t values for 10 and 30 degrees of freedom used to check the calculator).
Frequently asked questions
How do you calculate a 95% confidence interval for a mean?
Take the sample mean plus and minus the t value for n - 1 degrees of freedom times the standard deviation divided by the square root of n. For mean 52, s 8 and n 25 the t value is 2.064 and the interval is 48.70 to 55.30.
When should I use t instead of z?
Use t when the standard deviation comes from your sample, which is the usual case. Use z only when the population standard deviation is known. For large samples the two are almost the same.
What does a 95% confidence interval mean?
If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true mean. NIST points out it does not mean a 95% probability that this one interval contains the true mean.
How do I get a narrower interval?
Increase the sample size, since the standard error falls with the square root of n, or accept a lower confidence level. A smaller spread in the data also helps, but you rarely control that.
What is the margin of error?
Half the width of the interval: the critical value times the standard error. For the example it is 3.30.
What about percentages or conversion rates?
A proportion is not a mean of measurements. Use the proportion confidence interval calculator, which gives Wilson, exact and normal-approximation intervals.
Planning and learning aid
Educational calculator. The interval assumes a random sample from an approximately normal population or a sample large enough for the mean to be approximately normal.