Confidence Interval Calculator
Calculate confidence intervals for population means (known or unknown σ) and proportions. Find the margin of error, critical values, and interval bounds. Related tools: Margin of Error Calculator, Sample Size Calculator, and Standard Error Calculator.
How to Use the Confidence Interval Calculator
A confidence interval provides a range of plausible values for a population parameter based on sample data. This calculator supports three scenarios: estimating a population mean when σ is known (z-interval), estimating a mean when σ is unknown (t-interval), and estimating a population proportion (Wald interval).
Select the appropriate interval type, enter your sample statistics (mean or proportion, standard deviation, and sample size), and choose a confidence level (commonly 90%, 95%, or 99%). The calculator returns the confidence interval bounds, margin of error, critical value, and standard error.
The confidence level represents the long-run proportion of intervals that would contain the true parameter if the sampling were repeated many times. A 95% CI does NOT mean there is a 95% probability the parameter is in this specific interval — the parameter is fixed, and the interval either contains it or does not. Higher confidence levels produce wider intervals.
Formula
Mean (σ known — Z-interval):
CI = x̄ ± z*(α/2) × (σ / √n)
Mean (σ unknown — t-interval):
CI = x̄ ± t*(α/2, n-1) × (s / √n)
Proportion (Wald interval):
CI = p̂ ± z*(α/2) × √(p̂(1-p̂)/n)
Margin of Error:
E = critical value × standard error
Standard Error:
SE(mean) = σ/√n or s/√n
SE(proportion) = √(p̂(1-p̂)/n)
Example Calculation
A sample of 40 students has mean score 72.5 with s = 8.3. Find the 95% CI for the population mean:
Given: x̄ = 72.5, s = 8.3, n = 40, confidence = 95%
Method: t-interval (σ unknown)
df = 40 - 1 = 39
t*(0.025, 39) ≈ 2.023
SE = 8.3 / √40 = 8.3 / 6.325 = 1.3124
Margin of Error = 2.023 × 1.3124 = 2.655
CI = [72.5 - 2.655, 72.5 + 2.655]
95% CI: [69.845, 75.155]
We are 95% confident the population mean is between 69.8 and 75.2.
Critical Values Reference Table (z* and t*)
| Confidence | z* | t* (df=10) | t* (df=20) | t* (df=30) |
|---|---|---|---|---|
| 80% | 1.282 | 1.372 | 1.325 | 1.310 |
| 90% | 1.645 | 1.812 | 1.725 | 1.697 |
| 95% | 1.960 | 2.228 | 2.086 | 2.042 |
| 98% | 2.326 | 2.764 | 2.528 | 2.457 |
| 99% | 2.576 | 3.169 | 2.845 | 2.750 |
| 99.5% | 2.807 | 3.581 | 3.153 | 3.030 |
| 99.9% | 3.291 | 4.587 | 3.850 | 3.646 |
Real-World Applications
Clinical Trials
Researchers report the effect of a drug as a confidence interval for the mean difference. For example, "the drug reduced blood pressure by 8-14 mmHg (95% CI)" is more informative than just reporting p < 0.05 because it quantifies the likely magnitude of the effect.
Election Polling
When polls report "Candidate A: 52% +/- 3%," they are giving a 95% confidence interval of (49%, 55%). If this interval includes 50%, the race is considered a statistical tie. The margin of error depends on sample size and the proportion itself.
Manufacturing Quality Control
A factory reports the mean tensile strength of steel cables as "1200 +/- 15 N (99% CI)." If the minimum safety requirement is 1150 N, the entire CI is above this threshold, providing high confidence that the product meets specifications.
Additional Solved Examples
Example: CI for a Mean (Large Sample)
A survey of 200 commuters finds mean travel time = 42 minutes with SD = 18 minutes. Construct a 95% confidence interval for the true mean commute time.
SE = s/sqrt(n) = 18/sqrt(200) = 18/14.14 = 1.273
z* = 1.96 (for 95%)
ME = 1.96 x 1.273 = 2.495
CI = 42 +/- 2.495 = (39.5, 44.5)
Answer: We are 95% confident the true mean commute time is between 39.5 and 44.5 minutes. If we repeated this study 100 times, about 95 of those intervals would contain the true population mean.
Example: CI for a Proportion
In a poll of 600 voters, 342 (57%) support a policy. Construct a 99% confidence interval.
p_hat = 342/600 = 0.57
SE = sqrt(0.57 x 0.43/600) = sqrt(0.000409) = 0.0202
z* = 2.576 (for 99%)
ME = 2.576 x 0.0202 = 0.052
CI = 0.57 +/- 0.052 = (0.518, 0.622)
Answer: We are 99% confident that between 51.8% and 62.2% of all voters support the policy. Since the entire interval is above 50%, the policy has majority support even at the 99% confidence level.
Common Mistakes
Wrong interpretation of confidence level
A 95% CI does NOT mean "there is a 95% probability the true mean is in this interval." The true mean is fixed - it either is or is not in the interval. The 95% refers to the long-run success rate of the method: 95% of all such intervals would capture the true parameter.
Using z* when t* is appropriate
For small samples (n < 30) with unknown sigma, use t-critical values with df = n-1. Using z* = 1.96 instead of, say, t* = 2.26 (df=9) produces a CI that is too narrow, giving false precision.
Thinking wider CI means worse results
A wider CI can result from higher confidence level (99% vs 95%), smaller sample size, or greater variability. Increasing confidence level widens the interval - this is a trade-off between precision and confidence, not a sign of poor data.
Key Takeaways
- A confidence interval provides a range of plausible values for a population parameter, not just a point estimate.
- CI width depends on three factors: confidence level, sample size, and population variability.
- To halve the margin of error, you must quadruple the sample size (due to the square root relationship).
- If a CI for a difference includes zero, the difference is not statistically significant at that confidence level.
- CIs and hypothesis tests are two sides of the same coin: a value outside the 95% CI would be rejected at alpha = 0.05.
Frequently Asked Questions
What is a confidence interval?
A confidence interval is a range of values that is likely to contain the true population parameter. It is constructed from sample data and has an associated confidence level (e.g., 95%). The interval provides more information than a point estimate alone because it communicates the precision of the estimate. Wider intervals indicate less precision; narrower intervals indicate more precision.
What does 95% confidence actually mean?
A 95% confidence level means that if you repeated the sampling process many times and constructed a CI each time, approximately 95% of those intervals would contain the true population parameter. It does NOT mean there is a 95% probability that this particular interval contains the parameter. The parameter is a fixed (unknown) value — it is either in the interval or it is not.
When should I use a z-interval vs a t-interval?
Use a z-interval when the population standard deviation σ is known (rare in practice). Use a t-interval when σ is unknown and estimated by the sample standard deviation s (the common case). The t-interval produces wider intervals to account for the additional uncertainty in estimating σ. As sample size increases, the t-interval approaches the z-interval because t* approaches z*.
How does sample size affect the confidence interval?
Larger sample sizes produce narrower confidence intervals because the standard error (σ/√n or s/√n) decreases as n increases. Specifically, to halve the width of a CI, you need to quadruple the sample size (since width is proportional to 1/√n). This is why researchers perform power analysis and sample size calculations before collecting data — to ensure the CI will be narrow enough to be useful.
What is the margin of error?
The margin of error (E) is half the width of the confidence interval. It equals the critical value multiplied by the standard error: E = z* × SE or E = t* × SE. The CI is then [estimate - E, estimate + E]. In polling, the margin of error is typically reported at 95% confidence. A ±3% margin of error means the true proportion is within 3 percentage points of the reported value with 95% confidence.
What assumptions are required for confidence intervals?
For means: (1) random sampling, (2) independence of observations, (3) approximately normal population or large sample (n ≥ 30 by CLT). For proportions: (1) random sampling, (2) independence, (3) np̂ ≥ 10 and n(1-p̂) ≥ 10 for the normal approximation. If assumptions are violated, consider bootstrap confidence intervals or non-parametric methods as alternatives.