Statistics

95% Confidence Interval Calculator

Calculate confidence intervals for population means. Supports 90%, 95%, and 99% confidence levels with t-distribution and z-distribution.

Input method
Population σ known?

σ (sigma) is the true population standard deviation, which is rarely known. If unknown, the t-distribution accounts for additional uncertainty.

95% Confidence Interval
(70.52, 79.48)

We are 95% confident that the true population mean lies between 70.52 and 79.48

Sample mean (x̄)
75.0000
Standard deviation (s)
12.0000
Sample size (n)
30
Degrees of freedom
29
Standard error
2.1909
Critical value (t)
2.0456
Margin of error
± 4.4817
Lower bound
70.5183
Upper bound
79.4817

What is a confidence interval?

A confidence interval is a range of values that is likely to contain an unknown population parameter. Rather than estimating the parameter by a single value, an interval estimate gives a range of plausible values along with a probability that the true value falls within that range.

For example, a 95% confidence interval means that if we were to take many samples and calculate a confidence interval from each, approximately 95% of those intervals would contain the true population parameter.

The confidence interval formula

For a population mean, the confidence interval is:

xˉ±tα/2×sn\bar{x} \pm t_{\alpha/2} \times \frac{s}{\sqrt{n}}

Where:

  • = sample mean
  • t = critical value from t-distribution
  • s = sample standard deviation
  • n = sample size

The margin of error is:

E=tα/2×snE = t_{\alpha/2} \times \frac{s}{\sqrt{n}}

Confidence levels and critical values

t-distribution (unknown population σ)

Confidenceαα/2df = 10df = 30df = ∞
90%0.100.051.8121.6971.645
95%0.050.0252.2282.0421.960
99%0.010.0053.1692.7502.576

z-distribution (known population σ or large n)

Confidence levelz-score
90%1.645
95%1.960
99%2.576

When to use t vs z distribution

Use t-distribution when:

  • Population standard deviation (σ) is unknown
  • Sample size is small (n < 30)
  • Estimating from sample standard deviation (s)

Use z-distribution when:

  • Population standard deviation (σ) is known
  • Sample size is large (n ≥ 30)
  • Working with proportions

As sample size increases, the t-distribution approaches the normal (z) distribution.

Example calculation

A researcher measures the heights of 25 students and finds:

  • Sample mean (x̄) = 170 cm
  • Sample standard deviation (s) = 8 cm
  • Sample size (n) = 25

Calculate the 95% confidence interval:

df=n1=24t0.025,242.064SE=sn=825=1.6E=2.064×1.6=3.30CI=170±3.30=(166.7,173.3)\begin{aligned} df &= n - 1 = 24 \\ t_{0.025, 24} &\approx 2.064 \\ SE &= \frac{s}{\sqrt{n}} = \frac{8}{\sqrt{25}} = 1.6 \\ E &= 2.064 \times 1.6 = 3.30 \\ CI &= 170 \pm 3.30 = (166.7, 173.3) \end{aligned}

We are 95% confident the true mean height is between 166.7 cm and 173.3 cm.

Interpreting confidence intervals

Correct interpretation

"We are 95% confident that the interval (a, b) contains the true population parameter."

Common misinterpretations

  • ❌ "There's a 95% probability the population mean is in this interval"
  • ❌ "95% of the data falls within this interval"
  • ❌ "The sample mean will be in this range 95% of the time"

The population mean is fixed—it either is or isn't in the interval. The 95% refers to the long-run success rate of the method.

Factors affecting interval width

Sample size (n)

Larger samples produce narrower intervals:

Sample sizeMargin of error (relative)
n = 101.00
n = 250.63
n = 500.45
n = 1000.32
n = 4000.16

Variability (s)

Higher variability produces wider intervals. Reducing measurement error or using more homogeneous samples can help.

Confidence level

Higher confidence requires wider intervals:

ConfidenceRelative width
90%0.84
95%1.00
99%1.32

Sample size calculation

To achieve a desired margin of error E with confidence level (1-α):

n=(zα/2×sE)2n = \left(\frac{z_{\alpha/2} \times s}{E}\right)^2

Example

To estimate mean with margin of error ±2, s = 10, at 95% confidence:

n=(1.96×102)2=96.0497n = \left(\frac{1.96 \times 10}{2}\right)^2 = 96.04 \approx 97

Confidence intervals for proportions

For a proportion p̂ with sample size n:

p^±zα/2×p^(1p^)n\hat{p} \pm z_{\alpha/2} \times \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}

This requires np̂ ≥ 10 and n(1-p̂) ≥ 10 for the normal approximation to be valid.

One-sided confidence intervals

Sometimes you only care about an upper or lower bound:

Upper bound only

xˉ+tα×sn\bar{x} + t_{\alpha} \times \frac{s}{\sqrt{n}}

Lower bound only

xˉtα×sn\bar{x} - t_{\alpha} \times \frac{s}{\sqrt{n}}

Note: Use tα (not tα/2) for one-sided intervals.

Confidence intervals vs hypothesis testing

There's a direct relationship between confidence intervals and hypothesis tests:

  • If the 95% CI for μ doesn't contain μ₀, then a two-sided test would reject H₀: μ = μ₀ at α = 0.05
  • If the CI contains μ₀, the test would fail to reject

Common applications

Scientific research

  • Estimating treatment effects
  • Reporting measurement precision
  • Comparing groups

Polling and surveys

  • Election predictions (margin of error)
  • Public opinion estimates
  • Market research

Quality control

  • Process capability analysis
  • Tolerance intervals
  • Product specifications

Medical studies

  • Drug efficacy ranges
  • Diagnostic test accuracy
  • Survival analysis

Assumptions

For valid confidence intervals, the following assumptions should be met:

  1. Random sampling — Data should be randomly selected from the population
  2. Independence — Observations should be independent of each other
  3. Normality — For small samples, the population should be approximately normal (less critical for large n due to Central Limit Theorem)
  4. No outliers — Extreme values can distort results

Tips for practice

  1. Always report CIs with point estimates — They provide more information than significance tests alone
  2. Consider the CI width — A statistically significant but very wide CI may not be practically useful
  3. Use appropriate confidence level — 95% is standard, but 90% or 99% may be appropriate depending on context
  4. Check assumptions — Violations can make CIs invalid or misleading
  5. Increase sample size for precision — Larger samples give narrower, more useful intervals