Confidence Interval Calculator

What Is a Confidence Interval?

A confidence interval (CI) is a range of values, calculated from sample data, that is likely to contain the true population parameter with a specified probability (the confidence level). A 95% CI means that if you repeated the sampling process 100 times, approximately 95 of those intervals would contain the true parameter.

Confidence intervals are more informative than a single point estimate because they communicate both the best estimate and the uncertainty around it. They are used in clinical trials, opinion polls, quality control, and virtually every field that relies on sample data to draw conclusions about a larger population.

A wider interval indicates more uncertainty (smaller sample, more spread); a narrower interval indicates more precision (larger sample, less spread).

CI for a Mean: Z vs. t

The formula for a confidence interval for a population mean is:

CI = x̄ ± (critical value) × (σ / √n)

Whether you use a Z-value or t-value as the critical value depends on what you know about the population:

  • Known population σ (Z-test): Use Z-values from the standard normal distribution (e.g., Z = 1.96 for 95%). This is rarely the case in practice but is common in textbook problems.
  • Unknown population σ (t-test): Use t-values from the t-distribution with n−1 degrees of freedom. As sample size grows, t-values approach Z-values. This is the real-world default.

CI for a Proportion

When estimating a population proportion (e.g., the share of voters who support a candidate), the formula is the Wald interval:

CI = p̂ ± Z × √(p̂(1 − p̂) / n)

where p̂ is the sample proportion and n is the sample size

This approximation works well when both np̂ ≥ 10 and n(1−p̂) ≥ 10. For very small or large proportions or small sample sizes, consider the Wilson or Agresti-Coull interval instead.

Common Confidence Levels & Z-Values

Confidence Levelα (significance)Z-value (two-tailed)
80%0.201.282
85%0.151.440
90%0.101.645
95%0.051.960
99%0.012.576
99.5%0.0052.807

How to Reduce the Margin of Error

  • Increase sample size (n): The margin of error shrinks with √n — doubling n reduces the margin of error by about 29%.
  • Reduce variability: A smaller standard deviation (σ or s) produces a tighter interval. This is often done through careful measurement and experimental control.
  • Lower the confidence level: Accepting 90% instead of 95% produces a narrower interval, but you accept more risk of missing the true parameter.

Related Tools