Confidence Interval Calculator

Confidence interval for a mean from the sample mean, standard deviation and sample size.

Confidence interval
—
—
—
—

Calculate a confidence interval for a population mean at any confidence level, using the z (normal) or t distribution, and see the margin of error, standard error and critical value.

The confidence interval formula

A confidence interval for a mean is the sample mean plus or minus a margin of error:

CI = x̄ ± critical value × (s ÷ √n)

  • x̄ is the sample mean.
  • s ÷ √n is the standard error: the standard deviation divided by the square root of the sample size.
  • The critical value comes from the z (normal) distribution, or from the t-distribution with n − 1 degrees of freedom, so that the chosen percentage of the distribution lies between −critical and +critical.

Worked example

A class of 36 students has a mean test score of 72.5 with a standard deviation of 8. For a 95% confidence interval:

  • Standard error: 8 ÷ √36 = 8 ÷ 6 = 1.3333
  • Using z: the critical value is 1.9600, so the margin of error is 1.96 × 1.3333 = 2.6133, and the interval is 69.887 to 75.113.
  • Using t with 35 degrees of freedom: the critical value is 2.0301, the margin of error is 2.7068, and the interval is 69.793 to 75.207 — slightly wider, reflecting the extra uncertainty of estimating the standard deviation.

Common critical values (z)

Confidence levelCritical z
80%1.2816
90%1.6449
95%1.9600
98%2.3263
99%2.5758
99.9%3.2905

Frequently asked questions

What does a 95% confidence interval mean?

If you repeated the same sampling many times and built an interval each time, about 95% of those intervals would contain the true population mean. It does not mean there is a 95% chance the true mean lies in this one particular interval.

Should I use z or t?

Use z when you know the population standard deviation or have a large sample. Use t when you are estimating the standard deviation from your sample — the usual case in practice — especially with small samples. With large samples, the two give nearly the same interval.

How can I make the interval narrower?

Increase the sample size, since the standard error shrinks with the square root of n — quadrupling the sample halves the margin of error. Choosing a lower confidence level also narrows it, at the cost of being less confident.

What is the margin of error?

It is half the width of the interval: the critical value multiplied by the standard error. A result reported as 72.5 ± 2.6 has a margin of error of 2.6.

What z-value is used for 90%, 95% and 99% confidence?

The two-sided critical values are 1.645 for 90%, 1.960 for 95% and 2.576 for 99%. This calculator works out the exact value for any confidence level you enter.