For a mean, step by step, with the z and t versions and a worked example.
Written & reviewed by Dackohn; last reviewed October 2026.
To calculate a confidence interval for a mean: (1) compute the sample mean, (2) find the standard error SE = s / √n, (3) pick the critical value (1.96 for 95% with large n, or a t-value for small samples), (4) margin of error = critical × SE, (5) the interval is mean ± margin. Example: mean 100, s = 15, n = 40 gives a 95% CI of about [95.2, 104.8].
CI = x̄ ± (critical value) × (s / √n). The critical value is z (1.96 for 95%) when n is large or σ is known, and a t-value with n−1 df for small samples.
n = 40, mean = 100, s = 15.
The t-interval is slightly wider and is the correct choice when σ is estimated from the sample.
=CONFIDENCE.T(0.05, s, n)=CONFIDENCE.NORM(0.05, s, n)Add and subtract the result from the mean.
A 95% CI means that over many repeated studies, about 95% of such intervals would contain the true mean — not a 95% probability for this one interval. See the confidence intervals guide.
The margin of error shrinks with the square root of the sample size, so to halve the width you need about four times as many observations. With s = 15, a sample of 40 gives a 95% margin of about ±4.80, while a sample of 160 gives about ±2.34. To plan a study, rearrange the formula: for a margin of ±3 with s = 15 at 95%, n = (1.96 × 15 / 3)² = 96.04, so you need at least 97 observations. The sample size calculator does this for you.
For a percentage, such as 52 “yes” answers out of 80 (p̂ = 0.65), the textbook formula is p̂ ± 1.96 × √(p̂(1 − p̂)/n), which gives 0.545 to 0.755. This simple (Wald) interval can be misleading when n is small or the proportion is near 0% or 100%. The Wilson interval is more accurate and is the one most statisticians recommend: here it gives 0.541 to 0.745. The proportion confidence interval calculator uses the Wilson method.
Report the estimate with its interval and the confidence level, for example: “Mean score was 100 (95% CI 95.2 to 104.8, n = 40).” State whether you used a z or t critical value if the sample is small, and round the interval to the same precision as the estimate.
Do it instantly: the confidence interval calculator builds the interval from your data or summary stats.
See also: Confidence interval for a proportion · Margin of error calculator