Confidence Interval Calculator
Compute confidence intervals for means and proportions, with margin of error and critical z/t values shown.
📏 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 (such as a mean or proportion) with a specified level of confidence. Rather than giving a single point estimate, it quantifies the uncertainty inherent in sampling by providing an upper and lower bound around that estimate.
In practice, confidence intervals appear everywhere data-driven decisions are made. Clinical trials report drug efficacy as "reduced symptoms by 42% (95% CI: 35%–49%)." Political polls state "candidate leads with 48% support, margin of error ±3%, 95% confidence." Market research reports "average customer satisfaction score: 7.4 (90% CI: 7.1–7.7)." Each of these communicates both a best estimate and how precise that estimate is.
A common misconception is that a 95% CI means "there is a 95% probability the true value is inside this interval." In frequentist statistics, the true parameter is fixed (not random). The 95% refers to the method: if you drew 100 samples and calculated 100 intervals using this method, about 95 would contain the true parameter. Any single computed interval either does or does not contain it - probability no longer applies once you have the specific numbers.
This calculator computes CIs for two common situations: estimating a population mean (given sample mean, standard deviation, and n), and estimating a population proportion (given successes and n). Both modes display the margin of error, critical value, and standard error alongside the interval bounds.
📐 Formula
📖 How to Use This Calculator
Steps
💡 Example Calculations
Example 1 — Mean: Student Test Scores
A class of 36 students scored a mean of 72 with SD = 9. Find the 95% CI for the population mean.
Example 2 — Proportion: Election Poll
600 of 1,000 polled voters support a candidate. Find the 95% CI for the true proportion.
Example 3 — Mean at 99% Confidence
A factory measures 50 items: mean weight = 500 g, SD = 15 g. Find the 99% CI.
❓ Frequently Asked Questions
🔗 Related Calculators
What is a confidence interval in statistics?
A confidence interval (CI) is a range of values constructed from sample data that is likely to contain the true population parameter. A 95% CI means that if the study were repeated 100 times with different samples, approximately 95 of the 100 resulting intervals would contain the true population mean or proportion. It is NOT the probability that the true parameter lies in any single interval - once computed, the interval either contains the parameter or it does not.
What is the formula for a confidence interval for the mean?
CI = x̄ ± z* × (σ / √n), where x̄ is the sample mean, z* is the critical value for your confidence level (1.96 for 95%), σ is the population standard deviation, and n is the sample size. The term z* × (σ / √n) is the margin of error. When σ is unknown (the usual case), replace z* with the t* critical value from the t-distribution with n−1 degrees of freedom.
What is the 95% confidence interval z-score?
The critical value for a 95% confidence interval is z* = 1.96 (from the standard normal distribution). This means 95% of the area under the normal curve falls within ±1.96 standard deviations of the mean. For 90% CI, z* = 1.645; for 99% CI, z* = 2.576. These values come from the inverse of the normal CDF at (1 + confidence level) / 2.
How do I calculate a confidence interval for a proportion?
CI = p̂ ± z* × √(p̂(1−p̂)/n), where p̂ is the sample proportion (successes/n), z* is the critical value, and n is the sample size. For example, if 240 of 400 people (p̂ = 0.60) prefer a product at 95% CI: margin = 1.96 × √(0.60 × 0.40 / 400) = 1.96 × 0.0245 = 0.048. The CI is [0.552, 0.648], or roughly 55.2% to 64.8%.
What does it mean to be 95% confident?
Being 95% confident means the procedure used to construct the interval captures the true parameter 95% of the time across repeated samples. It describes the reliability of the method, not the probability of any single interval. Once you calculate a specific interval like [4.2, 5.8], that interval either contains the true mean or it doesn't - there is no probability attached to a fixed, computed interval.
How does sample size affect the confidence interval width?
The margin of error is proportional to 1/√n. To halve the margin of error, you need 4 times the sample size. To reduce it by one-third, you need 9 times as many observations. This is why large-scale surveys (n = 1,000+) can achieve margins of error below ±3%, while small studies (n = 25) may have margins of ±20% or more at the same confidence level.
When should I use z-distribution vs t-distribution for confidence intervals?
Use the z-distribution (standard normal) when: (1) the population standard deviation σ is known, or (2) the sample size n ≥ 30 (by the Central Limit Theorem, the sampling distribution is approximately normal). Use the t-distribution when σ is unknown and n < 30. The t-distribution has heavier tails, producing wider intervals that account for the additional uncertainty from estimating σ using the sample standard deviation s.
What is the margin of error?
The margin of error (MoE) is the half-width of the confidence interval: MoE = z* × SE, where SE is the standard error (σ/√n for means, √(p̂(1−p̂)/n) for proportions). If a poll reports a candidate at 48% ± 3%, the 3% is the margin of error at whatever confidence level the poll used (typically 95%). The full CI would then be [45%, 51%].
How does confidence level affect the interval width?
Higher confidence levels produce wider intervals. At 90% CI, z* = 1.645; at 95% CI, z* = 1.96; at 99% CI, z* = 2.576. A 99% CI is about 31% wider than a 95% CI (ratio = 2.576/1.96 ≈ 1.31). The tradeoff is precision vs. certainty: a 99% CI is more likely to contain the true parameter but provides a less precise estimate of its location.
What is the difference between confidence interval and prediction interval?
A confidence interval estimates where the true population mean lies. A prediction interval estimates where a single future observation will fall - always wider than the CI. For example, a CI might say the average height of men is [175.2 cm, 176.8 cm], while a prediction interval for one man's height might be [158 cm, 194 cm]. Use CI to estimate parameters; use prediction intervals to forecast individual observations.
What sample size is needed for a given margin of error?
Rearranging the margin of error formula: n = (z* × σ / MoE)². For proportions: n = z*² × p̂(1−p̂) / MoE². To achieve a 3% margin of error at 95% confidence for a proportion, using p̂ = 0.5 (worst case): n = 1.96² × 0.25 / 0.03² = 3.8416 × 0.25 / 0.0009 ≈ 1,068 observations.