Statistics
Confidence Intervals Explained: Formula, Meaning and Worked Examples
Math Solver Free Team
A confidence interval is a range of values, built from sample data, that is likely to contain the true population parameter: confidence interval = point estimate ± margin of error. For a population mean the formula is x̄ ± z*·(σ/√n), where x̄ is the sample mean, z* is the critical value for your confidence level (1.96 for 95%), σ is the standard deviation and n is the sample size. Example in one line: a sample of n = 36 with x̄ = 82 and s = 12 gives a 95% interval of 82 ± 3.92, that is (78.08, 85.92) — worked in full below.
What is a confidence interval?
A sample never tells you the exact population mean. Survey 36 students and their average score, x̄ = 82, is one sample's answer; a different 36 students would give a slightly different average. A confidence interval turns that single estimate into an honest range: instead of claiming "the mean is 82", you report "the mean is plausibly between about 78 and about 86, with 95% confidence". The interval has three parts:
- The point estimate: the single best guess from your sample — x̄ for a mean, p̂ for a proportion. It sits at the centre of the interval.
- The margin of error (ME): how far the interval extends on each side of the point estimate. It grows with variability and shrinks with sample size.
- The confidence level: usually 90%, 95% or 99% — how confident the method is, explained carefully below, because it is the most misread idea in introductory statistics.
Confidence intervals belong to the same family as the normal distribution: sample means are approximately normally distributed around the true mean, so a band of ±1.96 standard errors captures the middle 95% of that distribution. The gap between an estimate and the truth is also the subject of percent error and margin of error.
The confidence interval formula for a mean
When the population standard deviation σ is known, use the z-formula:
x̄ ± z* · (σ / √n)
The quantity σ/√n is the standard error (SE) — the typical distance between a sample mean and the true mean. The critical values you will use constantly are:
- 90% confidence → z* = 1.645
- 95% confidence → z* = 1.96
- 99% confidence → z* = 2.576
In practice σ is rarely known, so you replace it with the sample standard deviation s and, strictly, use a t critical value: x̄ ± t* · (s / √n). The t distribution has slightly heavier tails, so t* is a little larger than z* and the interval a little wider — the price of estimating σ from the same data. For large samples (roughly n ≥ 30) the difference is small, and many courses use z* = 1.96 with s as an approximation, as the worked example below does. Our statistics calculator gives you x̄ and s from raw data, and the z-score calculator checks critical values.
Worked example 1: a 95% confidence interval for a mean
Problem: A sample of n = 36 students has mean score x̄ = 82 and standard deviation s = 12. Build a 95% confidence interval for the true mean score.
- Standard error: SE = s / √n = 12 / √36 = 12 / 6 = 2.
- Margin of error: ME = z* × SE = 1.96 × 2 = 3.92.
- Interval: 82 ± 3.92 → (82 − 3.92, 82 + 3.92) = (78.08, 85.92).
Report it in words: "We are 95% confident that the true mean score lies between 78.08 and 85.92." Notice what the √n did: individual scores vary by ±12, but the mean of 36 typically misses the truth by only ±2. Averaging tames variability — that is the entire engine of the confidence interval.
What "95% confidence" actually means — and the common misreading
Here is the correct meaning: if you repeated the sampling and interval-building process many times, about 95% of the intervals you built would contain the true parameter. The 95% describes the long-run success rate of the method, not the probability for the one interval in front of you.
The common misreading is: "There is a 95% probability that the true mean is in (78.08, 85.92)." In the frequentist framework behind these formulas, the true mean is a fixed number — it is either inside this particular interval or it is not; no probability attaches to it. What varies from sample to sample is the interval. Think of it like a ring-toss game that lands around the peg 95% of the time: once a particular ring has landed, it either encircles the peg or it does not — the 95% was a property of your throwing method, not of that one ring. In everyday reporting, "we are 95% confident the mean lies between 78.08 and 85.92" is accepted shorthand, as long as you know what it really claims.
Worked example 2: a confidence interval for a proportion
Problem: In a survey of n = 400 voters, 56% support a proposal, so p̂ = 0.56. Build a 95% confidence interval for the true proportion.
- Standard error: SE = √(p̂(1 − p̂)/n) = √(0.56 × 0.44 / 400) = √(0.2464 / 400) = √0.000616 ≈ 0.0248.
- Margin of error: ME = 1.96 × 0.0248 ≈ 0.0486 — about ±4.9 percentage points.
- Interval: 0.56 ± 0.0486 → (0.511, 0.609), i.e. between about 51.1% and 60.9% support.
This is the "margin of error ±4.9 points" you see under every published poll — now you know it is just 1.96 standard errors of a proportion, and that the headline 56% is only the centre of a range.
How sample size and confidence level change the interval
- Bigger n → narrower interval. The margin of error shrinks like 1/√n. Quadruple the sample from n = 36 to n = 144 (same s = 12) and SE falls from 2 to 1, so the 95% margin halves from 3.92 to 1.96, giving (80.04, 83.96). To halve the margin you must quadruple the sample — precision is expensive.
- Higher confidence → wider interval. At 99%, z* = 2.576, so Example 1's margin grows to 2.576 × 2 = 5.15 and the interval widens to (76.85, 87.15). Demanding more certainty costs width; there is no free confidence.
- Bigger variability → wider interval. Double s and you double the standard error and the margin. No sample-size trick changes the data's own spread — only averaging more of it helps.
For the textbook development of these formulas, see the confidence intervals chapter of OpenStax Introductory Statistics 2e, a free peer-reviewed textbook.
Common mistakes with confidence intervals
- Saying "95% probability the parameter is in this interval". The 95% is the method's long-run success rate; the parameter is fixed and the interval is what varies.
- Using σ when you only have s (or ignoring t). With σ unknown and a small sample, use t* with s — z* understates the width and overstates your precision.
- Forgetting the √n. The standard error is s/√n, not s. Dividing 12 by 36 instead of 6 in Example 1 gives a wildly wrong margin.
- Confusing the interval with the data's range. (78.08, 85.92) is a range for the mean, not for individual scores — plenty of students scored outside it.
- Reading a wide interval as a failed study. A wide interval is honest information: it says the data pin the parameter down only loosely, usually because n is small or the data are variable.
Frequently asked questions
What is a confidence interval in simple words?
It is a range built from sample data — point estimate ± margin of error — that plausibly contains the true population value, together with a confidence level such as 95% describing how reliable the method is.
What is the formula for a confidence interval for a mean?
x̄ ± z*·(σ/√n) when σ is known, or x̄ ± t*·(s/√n) when σ is estimated by the sample standard deviation s. For 95% confidence, z* = 1.96.
Does 95% confidence mean a 95% probability the true mean is in my interval?
Not exactly. It means the method produces intervals that contain the true mean in about 95% of repeated samples. The true mean is fixed; your particular interval either contains it or not.
How do I calculate a confidence interval by hand?
Find the standard error (s/√n for a mean), multiply by the critical value (1.96 for 95%), and add and subtract the result from the point estimate. Example: 82 ± 1.96 × (12/6) = 82 ± 3.92 = (78.08, 85.92).
Why does a bigger sample give a narrower interval?
Because the standard error divides by √n: averages of more observations vary less from sample to sample. Quadrupling n halves the margin of error.