Confidence Interval Calculator Guide: What It Means and How to Calculate It
Quick Answer
- →A confidence interval gives a range of plausible values for a population parameter based on sample data.
- →Formula: CI = x̄ ± z* × (σ / √n) — or use t* when σ is unknown.
- →Common z* values: 1.645 (90%), 1.96 (95%), 2.576 (99%).
- →Quadrupling sample size halves the margin of error. Diminishing returns apply.
What Is a Confidence Interval?
A confidence interval (CI) is a range of values that likely contains the true population parameter you're trying to estimate. Instead of saying “the average height is 170 cm,” a confidence interval says “we're 95% confident the average height is between 168.5 cm and 171.5 cm.”
The concept was formalized by Jerzy Neyman in a 1937 paper in the Philosophical Transactions of the Royal Society. It remains one of the most widely used tools in inferential statistics — a 2019 survey in Nature Methods found that 87% of published biological research papers report confidence intervals or their equivalents.
The Correct Interpretation
This trips up even experienced researchers. A 95% confidence interval does notmean “there's a 95% chance the true value is in this range.”
The correct interpretation: if you repeated the experiment many times and calculated a 95% CI each time, about 95% of those intervals would contain the true population parameter. The true value is fixed — it either is or isn't in your interval. The 95% describes the method's reliability, not the probability for any single interval.
A 2014 study in Psychonomic Bulletin & Review by Hoekstra et al. found that 97% of researchers endorsed at least one misconception about confidence intervals. The most common error was treating the CI as a probability statement about the parameter.
The Formula: Z-Interval
When the population standard deviation (σ) is known:
CI = x̄ ± z* × (σ / √n)
Where:
- x̄ = sample mean
- z* = z-critical value for your confidence level
- σ = population standard deviation
- n = sample size
- σ / √n = standard error
Z-Critical Values
| Confidence Level | z* Value | α (two-tailed) |
|---|---|---|
| 90% | 1.645 | 0.10 |
| 95% | 1.960 | 0.05 |
| 99% | 2.576 | 0.01 |
| 99.9% | 3.291 | 0.001 |
Worked Example
A factory produces bolts with a known standard deviation of 0.05 mm. A sample of 50 bolts has a mean diameter of 10.02 mm. Find the 95% CI.
Standard error = 0.05 / √50 = 0.05 / 7.071 = 0.00707
Margin of error = 1.96 × 0.00707 = 0.01386
CI = 10.02 ± 0.01386
95% CI: (10.006, 10.034) mm
The T-Interval: When σ Is Unknown
In practice, you almost never know the population standard deviation. When you estimate it using the sample standard deviation (s), you use the t-distribution instead:
CI = x̄ ± t* × (s / √n)
The t-distribution was developed by William Sealy Gosset in 1908 while working at the Guinness brewery in Dublin. He published under the pseudonym “Student” because Guinness prohibited employees from publishing research — which is why it's called Student's t-distribution.
The t-distribution has heavier tails than the normal distribution, producing wider intervals. This accounts for the extra uncertainty of estimating σ. As sample size increases, the t-distribution approaches the z-distribution. Above n = 30, they're nearly identical.
T-Critical Values (95% Confidence)
| Degrees of Freedom (n – 1) | t* (95%) |
|---|---|
| 5 | 2.571 |
| 10 | 2.228 |
| 20 | 2.086 |
| 30 | 2.042 |
| 50 | 2.009 |
| 100 | 1.984 |
| ∞ | 1.960 (= z*) |
How Sample Size Affects the Interval
The margin of error is proportional to 1/√n. This means quadrupling your sample size cuts the margin of error in half. Here's the practical impact:
| Sample Size (n) | Margin of Error (95% CI, σ = 10) | Interval Width |
|---|---|---|
| 25 | ±3.92 | 7.84 |
| 100 | ±1.96 | 3.92 |
| 400 | ±0.98 | 1.96 |
| 1,000 | ±0.62 | 1.24 |
| 10,000 | ±0.20 | 0.39 |
This explains why political polls typically survey 1,000–1,500 people. The Pew Research Center notes that a sample of 1,000 produces a margin of error of about ±3.1 percentage points at 95% confidence. Going to 4,000 only improves it to ±1.5 points — at four times the cost.
Confidence Level vs Confidence Interval Width
Higher confidence means wider intervals. There's always a tradeoff between confidence and precision.
| Confidence Level | z* | Interval Width (relative) |
|---|---|---|
| 90% | 1.645 | Narrowest |
| 95% | 1.960 | 19% wider than 90% |
| 99% | 2.576 | 57% wider than 90% |
Most research uses 95% as a balance between confidence and precision. Medical trials and safety-critical applications often use 99%. The choice of confidence level should be decided before collecting data, not after.
Confidence Intervals for Proportions
When estimating a population proportion (like the percentage who prefer a product), the formula changes:
CI = p̂ ± z* × √(p̂(1 – p̂) / n)
Where p̂ is the sample proportion. Example: In a survey of 500 people, 280 (56%) prefer Brand A.
Standard error = √(0.56 × 0.44 / 500) = √(0.000493) = 0.0222
Margin of error = 1.96 × 0.0222 = 0.0435
95% CI: (51.7%, 60.3%)
The Associated Press Stylebook requires news organizations to report the margin of error alongside any poll result. A 2024 Gallup methodology report states they aim for a ±3% margin at 95% confidence for national polls, requiring roughly 1,000 respondents.
Common Mistakes to Avoid
Confusing Confidence with Probability
Wrong: “There's a 95% chance the mean is between 10 and 12.”
Right: “If we repeated this study many times, 95% of the intervals would contain the true mean.”
Ignoring Assumptions
Z and t intervals assume the data is approximately normally distributed or the sample is large enough (n ≥ 30) for the Central Limit Theorem to apply. For small, skewed samples, use bootstrap confidence intervals instead.
Overlapping Intervals and Significance
Two groups with overlapping 95% CIs are not necessarily statistically indistinguishable. A 2004 paper in The BMJ showed that two means can have overlapping 95% CIs and still differ significantly at p < 0.05. The correct comparison requires looking at the CI of the difference.
Calculate confidence intervals for your data
Try the Free Confidence Interval Calculator →Frequently Asked Questions
What does a 95% confidence interval actually mean?
A 95% confidence interval means that if you repeated the same study 100 times with new random samples, approximately 95 of those intervals would contain the true population parameter. It does not mean there is a 95% probability the true value falls within your specific interval. The 95% refers to the long-run reliability of the method.
What is the formula for a confidence interval?
For a population mean with known standard deviation: CI = x̄ ± z* × (σ / √n), where x̄ is the sample mean, z* is the critical value (1.96 for 95%), σ is the population standard deviation, and n is the sample size. When σ is unknown, replace z* with the t-critical value and σ with the sample standard deviation s.
When should I use a z-interval vs a t-interval?
Use a z-interval when the population standard deviation (σ) is known, which is rare in practice. Use a t-interval when you estimate σ from your sample data (using s), which is the typical case. For sample sizes above 30, the z and t distributions are nearly identical.
How does sample size affect the confidence interval?
Larger samples produce narrower confidence intervals because the standard error (σ/√n) decreases as n increases. Quadrupling the sample size cuts the interval width in half. Going from n = 100 to n = 400 halves the margin of error. However, there are diminishing returns at large sample sizes.
What is the margin of error?
The margin of error is the “plus or minus” part of a confidence interval. It equals z* × (σ / √n) for a z-interval or t* × (s / √n) for a t-interval. In polling, a “±3% margin of error” means the reported percentage could be up to 3 points higher or lower than the true population value.