What a confidence interval is
A sample gives you an estimate, and a different sample would have given a slightly different one. A confidence interval puts a margin around the estimate wide enough to allow for that sampling variation. Every interval on this page has the same shape:
interval = estimate ± critical value × standard error
The standard error measures how much the estimate would vary from sample to sample. The critical value is a multiplier set by the confidence level. The product of the two is the margin of error.
Interval for a mean
x̄ ± t* × s ÷ √n with n − 1 degrees of freedom
x̄ ± z* × σ ÷ √n when the population standard deviation σ is known
Here x̄ is the sample mean, s is the sample standard deviation, n is the sample size, and t* is the critical value of Student’s t-distribution. Use the first formula whenever the standard deviation was worked out from the same sample, which is nearly always. The second, with the normal critical value z*, applies only when σ is genuinely known from elsewhere, such as a long-established process.
Interval for a proportion
p̂ ± z* × √(p̂ × (1 − p̂) ÷ n) where p̂ = x ÷ n
Wilson: [p̂ + z*² ÷ 2n ± z* × √(p̂(1 − p̂) ÷ n + z*² ÷ 4n²)] ÷ (1 + z*² ÷ n)
Here x is the number of “successes” and p̂ (p-hat) is the sample proportion. The first formula is the normal approximation, often called the Wald interval, and is the one in most textbooks. The Wilson score interval comes from the same normal theory but behaves much better for small samples and for proportions near 0 or 1.
Critical values
| Confidence | z* | t*, 5 df | t*, 10 df | t*, 30 df | t*, 100 df |
|---|---|---|---|---|---|
| 90% | 1.645 | 2.015 | 1.812 | 1.697 | 1.660 |
| 95% | 1.960 | 2.571 | 2.228 | 2.042 | 1.984 |
| 99% | 2.576 | 4.032 | 3.169 | 2.750 | 2.626 |
The t values are larger than z because estimating the standard deviation from a small sample adds uncertainty of its own. As the sample grows, t* shrinks towards z*. The calculator finds t* by solving the exact t-distribution for your degrees of freedom, so it is not limited to the rows of a printed table.
Worked examples by hand
A mean
A sample of 25 students has a mean score of 72 with a standard deviation of 10. Find the 95% confidence interval.
- Standard error. 10 ÷ √25 = 10 ÷ 5 = 2.
- Critical value. Degrees of freedom = 25 − 1 = 24. For 95% confidence, t* = 2.064.
- Margin of error. 2.064 × 2 = 4.13.
- Interval. 72 − 4.13 = 67.87 and 72 + 4.13 = 76.13.
Had the standard deviation of 10 been a known population figure, z* = 1.960 would apply and the interval would be 72 ± 3.92, or 68.08 to 75.92. At 99% confidence with t, the margin widens to ±5.59.
A proportion
In a poll of 1,000 people, 520 say yes.
- Sample proportion. p̂ = 520 ÷ 1,000 = 0.52.
- Standard error. √(0.52 × 0.48 ÷ 1,000) = √0.0002496 = 0.0158.
- Margin of error. 1.960 × 0.0158 = 0.0310, about 3.1 percentage points.
- Interval. 0.52 ± 0.031 gives 0.489 to 0.551, or 48.9% to 55.1%.
The interval includes 50%, so this poll cannot rule out an even split. The Wilson interval for the same data is 48.9% to 55.1% as well; with a large sample and a proportion near the middle, the two methods agree.
Reading the interval correctly
What “95% confident” means
The 95% describes the method, not one particular interval. If you repeated the whole study many times and built an interval each time, about 95 in every 100 of those intervals would contain the true value. Your interval is one of them, and you cannot tell whether it is one of the 95 or one of the 5.
The common misreading
It is tempting to say “there is a 95% probability that the true mean lies between 67.87 and 76.13”. In the standard framework that is not what has been shown: the true mean is a fixed number, so it is either inside this interval or it is not. A second frequent mistake is to read the interval as the range containing 95% of individual values. It is not. It describes uncertainty about the average, and it is much narrower than the spread of the data itself.
What changes the width
Higher confidence means a wider interval. More data means a narrower one, but only in proportion to √n: with σ known to be 10, a sample of 25 gives ±3.92 and it takes a sample of 100, four times the size, to halve that to ±1.96.
When the normal approximation for a proportion fails
The Wald interval needs at least about 10 successes and 10 failures. With 2 successes in 20 trials it gives 0.10 ± 0.131, which runs from −3.1% to 23.1%, and a negative proportion is impossible. The Wilson interval for the same data is 2.8% to 30.1%. When the calculator warns that the sample is small, quote the Wilson figures.
Assumptions that must hold
The sample must be random, or at least representative, and the observations independent. For a mean with a small sample, the data should be roughly bell-shaped without extreme outliers; from about 30 observations upwards the method is forgiving. No interval corrects for a biased sample: a margin of error covers sampling variation only, not badly worded questions or people who did not respond.