Confidence Interval Calculator

Compute confidence intervals for mean or proportion with AI-powered step-by-step solutions

Drag & drop or click to add images or PDF

Math Input
95% CI for mean with n=30, sample mean=72, sample sd=8
99% CI for proportion with 240 successes in 400 trials
Margin of error for 95% CI, n=100, p_hat=0.55
90% CI for mean with population sd=15, n=64, x_bar=50

What is a Confidence Interval?

A confidence interval (CI) is a range of plausible values for an unknown population parameter, constructed from sample data. A 95% confidence interval means: if you repeated the sampling procedure many times, about 95% of the constructed intervals would contain the true parameter.

Important: the 95% refers to the procedure, not to any single computed interval. Once an interval is constructed from data, it either does or doesn't contain the true parameter — but we don't know which.

Core structure: every confidence interval has the form

estimate±margin of error\text{estimate} \pm \text{margin of error}

The estimate is the sample statistic (xˉ\bar{x} or p^\hat{p}). The margin of error is a critical value times the standard error of the estimate.

Confidence intervals appear in:

  • Election polling ('52% support, ±3%\pm 3\% margin of error')
  • Medical studies (effect size CIs)
  • Quality control (mean defect rates)
  • Any time you want to quantify uncertainty in an estimate, not just report a point value.

How to Compute Confidence Intervals

CI for a Population Mean (Z-Interval)

When the population standard deviation σ\sigma is known and the sampling distribution is approximately normal (large nn or normal population):

xˉ±zσn\bar{x} \pm z^* \cdot \frac{\sigma}{\sqrt{n}}

where zz^* is the critical value for the chosen confidence level.

CI for a Population Mean (T-Interval)

When σ\sigma is unknown (you only have ss, the sample standard deviation) — much more common in practice:

xˉ±tn1sn\bar{x} \pm t^*_{n-1} \cdot \frac{s}{\sqrt{n}}

The critical value tt^* comes from the t-distribution with n1n - 1 degrees of freedom. For large nn (30\geq 30), tzt^* \approx z^* and the two intervals are very similar.

CI for a Population Proportion

For a sample proportion p^=x/n\hat{p} = x/n (where xx is the number of successes):

p^±zp^(1p^)n\hat{p} \pm z^* \cdot \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}

Valid when np^10n\hat{p} \geq 10 and n(1p^)10n(1 - \hat{p}) \geq 10 (success-failure condition).

Critical Values

Confidence levelzz^*t29t^*_{29} (df = 29)
90%1.6451.699
95%1.962.045
99%2.5762.756

Margin of Error

ME=(critical value)×(standard error)\text{ME} = (\text{critical value}) \times (\text{standard error})

Increasing the sample size nn decreases the standard error (and therefore the margin of error) by a factor of n\sqrt{n}. Quadrupling nn halves the margin of error.

Choosing Confidence Level

  • Higher confidence = wider interval. A 99% CI is wider than a 95% CI, which is wider than a 90% CI.
  • 95% is the default in most academic and professional contexts.
  • 99% when stakes are higher (medical, safety); 90% when a tighter point estimate matters more than coverage.

Common Mistakes to Avoid

  • Misinterpreting the 95%: 'There is a 95% probability the true mean is in this interval' is wrong (frequentist). The correct statement is about the procedure: 95% of similarly constructed intervals contain the true parameter.
  • Using z when t is appropriate: with unknown σ\sigma, use tt^*. Using zz^* understates uncertainty, especially for small nn.
  • Forgetting n\sqrt{n} in the standard error: σ/n\sigma/\sqrt{n}, not σ/n\sigma/n.
  • Wrong critical value direction: z=1.96z^* = 1.96 for 95% (two-tailed), not 95th-percentile z=1.645z = 1.645. The two-tailed critical value cuts off α/2\alpha/2 in each tail.
  • Skipping the success-failure condition for proportions: if np^n\hat{p} or n(1p^)<10n(1-\hat{p}) < 10, the normal approximation breaks down — use an exact (Clopper-Pearson) or score-based interval.
  • Conflating CI with prediction interval: a 95% CI estimates the mean with 95% coverage. A prediction interval estimates a single future observation — much wider.

Examples

Step 1: σ\sigma unknown, n30n \geq 30 — use t-interval with df=29df = 29
Step 2: t2.045t^* \approx 2.045 (from t-table)
Step 3: Standard error: s/n=8/301.461s/\sqrt{n} = 8/\sqrt{30} \approx 1.461
Step 4: Margin of error: 2.045×1.4612.9872.045 \times 1.461 \approx 2.987
Step 5: CI: 72±2.987(69.01,74.99)72 \pm 2.987 \approx (69.01, 74.99)
Answer: 95% CI: approximately (69.0,75.0)(69.0, 75.0)

Step 1: p^=240/400=0.6\hat{p} = 240/400 = 0.6
Step 2: Success-failure check: 4000.6=24010400 \cdot 0.6 = 240 \geq 10 and 4000.4=16010400 \cdot 0.4 = 160 \geq 10
Step 3: Standard error: 0.60.4/400=0.0006=0.0245\sqrt{0.6 \cdot 0.4 / 400} = \sqrt{0.0006} = 0.0245
Step 4: z=2.576z^* = 2.576 for 99%
Step 5: Margin of error: 2.576×0.02450.0632.576 \times 0.0245 \approx 0.063
Step 6: CI: 0.6±0.063=(0.537,0.663)0.6 \pm 0.063 = (0.537, 0.663)
Answer: 99% CI for the proportion: approximately (0.537,0.663)(0.537, 0.663)

Step 1: σ\sigma known — use z-interval
Step 2: z=1.645z^* = 1.645 for 90%
Step 3: Standard error: σ/n=15/64=15/8=1.875\sigma/\sqrt{n} = 15/\sqrt{64} = 15/8 = 1.875
Step 4: Margin of error: 1.645×1.8753.0841.645 \times 1.875 \approx 3.084
Step 5: CI: 50±3.084=(46.92,53.08)50 \pm 3.084 = (46.92, 53.08)
Answer: 90% CI: approximately (46.92,53.08)(46.92, 53.08)

Frequently Asked Questions

It means that if you repeated the entire sampling and interval-construction procedure many times, about 95% of the resulting intervals would contain the true population parameter. It is a statement about the procedure, not a probability statement about any single interval.

Use t whenever the population standard deviation σ is unknown and you're estimating with the sample standard deviation s — which is almost always in practice. Use z only when σ is genuinely known (rare outside textbook problems).

The margin of error shrinks proportionally to 1/√n. To halve the margin of error, you need to quadruple the sample size — diminishing returns set in fast.

A confidence interval estimates a population parameter (like the mean) with a given coverage rate. A prediction interval estimates a single future observation and is much wider, because it must account for both the uncertainty in the mean *and* the spread of individual values around it.

Related Solvers

Standard Deviation CalculatorProbability CalculatorMean Median Mode Calculator
Try AI-Math for Free

Get step-by-step solutions to any math problem. Upload a photo or type your question.

Start Solving