HomeStatisticsConfidence Intervals

Confidence Intervals
Estimating Population Parameters

Learn what a confidence interval truly means, how to construct z-intervals and t-intervals, calculate the margin of error, and avoid the most common misinterpretations. 10 fully worked examples, interactive diagram, and a 10-question quiz.

StatisticsEstimationz-intervalt-intervalMargin of Error
Share this page

What Is a Confidence Interval?

Whenever you estimate a population parameter from a sample, you get a single number, a point estimate. The problem is that this estimate will almost certainly not equal the true population value. A different sample would give a slightly different estimate. How wrong could you be?

A confidence interval (CI) answers this by giving you a range of plausible values for the population parameter, together with a stated level of confidence. Instead of saying "the population mean is 72," you say "I am 95% confident the population mean lies between 68.4 and 75.6."

The interval is built around the point estimate, and its width is determined by three things: the confidence level (how certain you want to be), the standard error of the estimate (which depends on sample size and variability), and the appropriate critical value from a z or t distribution.

Prerequisites. You should be comfortable with the normal distribution, z-scores, and the Central Limit Theorem before this page. The Sampling & Estimation page covers all the background needed.

The CI Formula — z-interval

When the population standard deviation σ is known, the confidence interval for the population mean μ is:

Confidence Interval for μ (σ known) CI = x̄ ± z* · (σ / √n)

x̄ = sample mean
z* = critical value (from standard normal table)
σ = population standard deviation
n = sample size
σ/√n = standard error (SE)

The term z* · (σ/√n) is called the margin of error (ME). It is how far the interval extends on each side of x̄.

The critical value z* depends on the confidence level. The three most common values are:

Confidence Levelα (significance)α/2z* (critical value)
90%0.100.051.645
95%0.050.0251.960
99%0.010.0052.576

What 95% Confidence Actually Means

This is the most misunderstood concept in introductory statistics. A 95% CI does not mean there is a 95% probability that μ lies in your computed interval. The true μ is a fixed (unknown) constant, once you compute the interval from your data, μ either is or is not inside it. The probability is not 95%; it is either 0 or 1.

What 95% refers to is the procedure, not any single interval. If you were to take 100 different random samples and construct a 95% CI from each one, approximately 95 of those intervals would contain the true μ. Your specific interval is one realisation of that procedure.

What 95% CI does NOT mean. "There is a 95% chance μ is in this interval." The parameter μ is not random — only the interval is random (because it depends on the random sample). The correct phrasing is: "We used a procedure that captures μ 95% of the time."

Interactive Diagram — Repeated Sampling

Confidence Interval Simulation

Click "Draw new samples" to see 20 confidence intervals built from repeated random samples. Intervals that miss the true mean (red dashed line) are highlighted in red.

When σ Is Unknown — the t-interval

In practice, σ is almost never known. You replace it with the sample standard deviation s, but this introduces extra uncertainty, especially for small samples. To account for this, you use the t-distribution with n − 1 degrees of freedom rather than the standard normal.

Confidence Interval for μ (σ unknown — t-interval) CI = x̄ ± t* · (s / √n)

t* = t-critical value with df = n − 1
s = sample standard deviation

The t-distribution has heavier tails than the normal, making the interval wider to reflect the additional uncertainty from estimating σ. As n increases, the t-distribution converges to the standard normal, for n ≥ 30, the difference is usually negligible in practice.

Rule of thumb. If σ is known, use z*. If σ is unknown and n ≥ 30, you can use z* with s in place of σ (the approximation is excellent). If σ is unknown and n < 30, always use t* with df = n − 1.

Margin of Error and Sample Size

The margin of error ME = z* · (σ/√n) controls the width of the interval. To make the interval narrower (more precise) you can:

1. Increase the sample size n. Since ME ∝ 1/√n, quadrupling n halves the margin of error. This is the most practical lever.

2. Reduce the confidence level. A 90% CI is narrower than a 95% CI, but you sacrifice certainty.

3. Reduce σ. This means collecting more homogeneous data or improving measurement precision.

Required Sample Size for Desired Margin of Error E n = (z* · σ / E)²

Round UP to the nearest integer — rounding down gives an interval wider than E.

10 Fully Worked Examples

Example 1 — Basic 95% z-intervalEasy
A sample of n = 64 has x̄ = 50, and the population σ = 8. Construct a 95% CI for μ.
1
SE = σ/√n = 8/√64 = 8/8 = 1.
2
z* = 1.960 for 95% confidence.
3
ME = 1.960 × 1 = 1.960.
4
CI = 50 ± 1.960 = (48.04, 51.96).
95% CI: (48.04, 51.96)
Example 2 — 99% z-intervalEasy
x̄ = 120, σ = 15, n = 36. Build a 99% CI for μ.
1
SE = 15/√36 = 15/6 = 2.5.
2
z* = 2.576 for 99% confidence.
3
ME = 2.576 × 2.5 = 6.44.
4
CI = 120 ± 6.44 = (113.56, 126.44).
99% CI: (113.56, 126.44)
Example 3 — t-interval, small sampleMedium
A sample of n = 16 yields x̄ = 42 and s = 5. Construct a 95% CI for μ (σ unknown).
1
df = n − 1 = 15. From t-table, t* = 2.131 at 95%, df = 15.
2
SE = s/√n = 5/4 = 1.25.
3
ME = 2.131 × 1.25 = 2.664.
4
CI = 42 ± 2.664 = (39.34, 44.66).
95% t-interval: (39.34, 44.66)
Example 4 — Find the required sample sizeMedium
You want a 95% CI for μ with ME ≤ 3. The population σ = 12. What sample size is needed?
1
Formula: n = (z* · σ / E)²
2
n = (1.960 × 12 / 3)² = (23.52/3)² = (7.84)² = 61.47.
3
Round up: n = 62.
Required n = 62 (always round up)
Example 5 — 90% CI, interpret in contextEasy
A factory measures 100 bolts: x̄ = 10.2 mm, σ = 0.5 mm. Construct and interpret a 90% CI for the mean bolt length.
1
SE = 0.5/√100 = 0.05.
2
z* = 1.645 for 90%. ME = 1.645 × 0.05 = 0.082.
3
CI = 10.2 ± 0.082 = (10.118, 10.282).
4
Interpretation: We are 90% confident the true mean bolt length lies between 10.118 mm and 10.282 mm.
90% CI: (10.118 mm, 10.282 mm)
Example 6 — CI for a proportionMedium
In a survey of 400 people, 240 said yes. Construct a 95% CI for the population proportion p.
1
p̂ = 240/400 = 0.60.
2
SE = √(p̂(1−p̂)/n) = √(0.6 × 0.4/400) = √(0.0006) = 0.0245.
3
ME = 1.960 × 0.0245 = 0.048.
4
CI = 0.60 ± 0.048 = (0.552, 0.648).
95% CI for p: (0.552, 0.648) or (55.2%, 64.8%)
Example 7 — Effect of increasing nMedium
Compare 95% CIs for x̄ = 80, σ = 20 with n = 25 vs n = 100.
1
n = 25: SE = 20/5 = 4. ME = 1.96 × 4 = 7.84. CI = (72.16, 87.84). Width = 15.68.
2
n = 100: SE = 20/10 = 2. ME = 1.96 × 2 = 3.92. CI = (76.08, 83.92). Width = 7.84.
3
Quadrupling n halved the width (15.68 → 7.84). Width ∝ 1/√n.
Width halves when n quadruples — precision cost is quadratic
Example 8 — t-interval, df = 9Medium
Ten exam scores: x̄ = 74, s = 8. Construct a 99% CI.
1
df = 9. From t-table: t* = 3.250 at 99%, df = 9.
2
SE = 8/√10 = 8/3.162 = 2.530.
3
ME = 3.250 × 2.530 = 8.22.
4
CI = 74 ± 8.22 = (65.78, 82.22).
99% t-interval (df = 9): (65.78, 82.22)
Example 9 — Back-calculate σ from CIHard
A 95% CI is reported as (44.1, 55.9) with n = 49. Recover σ.
1
x̄ = (44.1 + 55.9)/2 = 50. ME = 55.9 − 50 = 5.9.
2
ME = z* · σ/√n → 5.9 = 1.960 · σ/7.
3
σ = 5.9 × 7 / 1.960 = 41.3/1.96 = 21.07.
σ ≈ 21.1
Example 10 — Sample size for proportionHard
How many people must you survey to estimate a proportion within ±2% at 95% confidence? (No prior estimate of p.)
1
When p is unknown, use p̂ = 0.5 (maximises SE, most conservative).
2
n = z*² · p(1−p) / E² = (1.96)² × 0.25 / (0.02)² = 3.8416 × 0.25 / 0.0004.
3
n = 0.9604 / 0.0004 = 2401.
Required n = 2401 — the classic "±2% poll" sample size

Common Mistakes

Mistake 1 — Wrong interpretation. "There is a 95% probability that μ is in this interval." No — μ is fixed. The 95% refers to the long-run coverage of the procedure, not any single interval.
Mistake 2 — Using z when you should use t. If σ is unknown and n < 30, always use the t-distribution with df = n − 1. Using z underestimates the width of the interval.
Mistake 3 — Rounding sample size down. When solving for n, always round UP. Rounding down gives a margin of error slightly larger than desired.
Mistake 4 — Confusing width and margin of error. The width of a CI is 2 × ME (it covers both sides). The margin of error is just one side: z* · SE.
Mistake 5 — Forgetting conditions. The z-interval assumes: (i) random sample, (ii) n large enough for CLT (≥ 30) or population is normal, (iii) σ known. Check these before computing.

10-Question Quiz

Confidence Intervals — Quiz

10 questions · immediate feedback · score tracked

Score 0 / 0
Question 1 of 10
What is the z* critical value for a 95% confidence interval?
Question 2 of 10
Which correctly interprets a 95% CI of (48, 54)?
Question 3 of 10
A sample has x̄ = 80, σ = 10, n = 100. What is the 95% CI?
Question 4 of 10
When should you use a t-interval instead of a z-interval?
Question 5 of 10
If you quadruple the sample size, the margin of error:
Question 6 of 10
Fill in: The width of a 95% CI equals 2 × ___
Question 7 of 10
What sample size gives ME ≤ 5 at 95% confidence with σ = 20?
Question 8 of 10
A 99% CI is _______ than a 95% CI for the same data.
Question 9 of 10
For a proportion CI with no prior estimate of p, which value of p̂ gives the most conservative (widest) interval?
Question 10 of 10
A t-interval with df = 20 is used. As df → ∞, the t* critical value approaches:

Cookie Settings