Math Calculators

Confidence Interval Calculator

Compute the confidence interval for the mean of a sample using the standard normal distribution (z-interval).

%

About the confidence interval calculator

A confidence interval (CI) is a range of values around a sample statistic that is expected to contain the true population parameter with a specified probability, called the confidence level. Common levels are 90%, 95% and 99%.

When the population standard deviation is known, or the sample size is large enough for the Central Limit Theorem to apply, the z-interval can be used. The formula is CI = X̄ ± Z × (σ/√n), where X̄ is the sample mean, σ the standard deviation, n the sample size, and Z the critical value of the standard normal distribution for the chosen confidence level.

The half-width of the interval, Z × (σ/√n), is the margin of error. Narrower intervals indicate more precise estimates, which can be achieved by a larger sample size, a smaller standard deviation, or a lower confidence level.

This calculator also shows the interval as an error bar, visualizing the estimate and the spread of possible values around it.

How to use

  • Enter the sample size n.
  • Enter the sample mean X̄ (average of your observations).
  • Enter the standard deviation σ or s.
  • Enter the confidence level as a percentage (e.g. 95).
  • Click Calculate to see the interval, margin of error, and step-by-step formula.

Core formula

CI = X̄ ± Z × (σ/√n). The margin of error is ME = Z × (σ/√n). The interval [X̄ − ME, X̄ + ME] contains the true mean with the chosen probability under the normal assumption.

FAQ

When should I use a z-interval vs a t-interval?

Use a z-interval when σ is known or n is large (n ≥ 30). Use a t-interval with s instead when n is small and σ is unknown.

What does 95% confidence really mean?

If you took many samples and computed a 95% CI for each, about 95% of those intervals would contain the true mean.

How does sample size affect the interval?

Doubling n roughly shrinks the margin of error by √2 (about 29%).

What Z-value does 95% use?

Z ≈ 1.960 for a two-tailed 95% confidence level.