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].

The formula

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.

Step by step

  1. Compute the sample mean and standard deviation s.
  2. Standard error: SE = s / √n.
  3. Choose the confidence level and critical value (95% → z = 1.96, or a t-value from the t-table).
  4. Margin of error = critical × SE.
  5. Interval = mean − margin to mean + margin.

Worked example

n = 40, mean = 100, s = 15.

The t-interval is slightly wider and is the correct choice when σ is estimated from the sample.

In Excel or Google Sheets

Add and subtract the result from the mean.

How to read it

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.

Common mistakes

Do it instantly: the confidence interval calculator builds the interval from your data or summary stats.

Related

CI CalculatorT-TableCI explained