Key facts
- CI = x̄ ± critical value × (s ÷ √n).
- A sample of 40 with mean 50 and SD 8 gives a 95% CI of 47.52 to 52.48.
- Common z critical values: 90% = 1.645, 95% = 1.960, 99% = 2.576.
- Bigger samples give narrower intervals; quadrupling n halves the margin of error.
What is a confidence interval?
When you measure a sample, its mean is an estimate of the population mean, and a different sample would give a slightly different number. A confidence interval puts a range around the estimate to show that uncertainty. A 95% confidence interval comes from a method that, if you repeated the study many times, would capture the true mean in about 95% of those intervals.
How to use the confidence interval calculator
- Enter the sample mean (x̄), the sample standard deviation (s) and the sample size (n).
- Choose a confidence level: 80%, 90%, 95%, 98%, 99% or 99.9%.
- Read the interval, the margin of error, the standard error and the critical value used.
Confidence interval formula
CI = x̄ ± z* × (s ÷ √n) (n of 30 or more)CI = x̄ ± t* × (s ÷ √n) (n under 30, with n − 1 degrees of freedom)Standard error SE = s ÷ √n, Margin of error E = critical value × SE| Symbol | Meaning |
|---|---|
| x̄ | Sample mean |
| s | Sample standard deviation |
| n | Sample size |
| z*, t* | Critical value for the chosen confidence level |
| E | Margin of error, half the width of the interval |
Critical values
| Confidence level | z* | t* (df = 9) | t* (df = 19) |
|---|---|---|---|
| 80% | 1.282 | 1.383 | 1.328 |
| 90% | 1.645 | 1.833 | 1.729 |
| 95% | 1.960 | 2.262 | 2.093 |
| 98% | 2.326 | 2.821 | 2.539 |
| 99% | 2.576 | 3.250 | 2.861 |
| 99.9% | 3.291 | 4.781 | 3.883 |
The t values are larger for small samples, which widens the interval to reflect the extra uncertainty in estimating the SD.
Step-by-step examples: confidence intervals
Example 1: large sample
40 customers spend an average of $50 with an SD of $8. SE = 8 ÷ √40 ≈ 1.265. At 95%, E = 1.96 × 1.265 ≈ 2.479. The interval is $47.52 to $52.48.
Example 2: small sample
10 bolts have a mean length of 10 mm and an SD of 2 mm. With n = 10, use t* = 2.262 (9 degrees of freedom). SE = 2 ÷ √10 ≈ 0.632, so E ≈ 1.431. The 95% interval is 8.57 to 11.43 mm.
How to read it correctly
- Right: "We are 95% confident the true mean is between 47.52 and 52.48."
- Not quite right: "There is a 95% probability the true mean is in this interval." The true mean is fixed; it is the interval that varies from sample to sample.
- A wider interval is more likely to contain the mean but is less precise.
What makes an interval narrower?
| Change | Effect on width |
|---|---|
| Increase sample size n | Narrower (width ∝ 1 ÷ √n) |
| Lower the confidence level | Narrower |
| Less variable data (smaller s) | Narrower |
To plan how many people to survey for a target margin of error, use the sample size calculator.
Common mistakes with confidence intervals
- Using the population SD formula for a sample. Use the sample SD (dividing by n − 1).
- Using z for small samples. Under 30, the t distribution gives a more honest interval.
- Applying it to biased samples. A confidence interval cannot fix a sample that does not represent the population.
- Overlap myths. Two intervals that overlap slightly can still show a statistically significant difference.
Confidence intervals, Guinness and opinion polls
A confidence interval gives a range of plausible values for a population mean, based on a sample. The idea was formalized by Jerzy Neyman in a 1937 paper. For small samples, the interval uses Student’s t-distribution, published in 1908 in *Biometrika* by William Sealy Gosset, a chemist at the Guinness brewery in Dublin who studied small batches of barley and hops. Guinness did not allow staff to publish under their own names, so he signed the paper "Student".
The interpretation is subtle. A 95% confidence interval does not mean there is a 95% chance the true value lies inside this particular range; it means that if you repeated the sampling many times, about 95% of the intervals built this way would contain the true value. Opinion polls report confidence intervals as a margin of error: a random sample of about 1,000 people gives roughly ±3 percentage points at 95% confidence, and the margin for differences between candidates is larger. Medical studies report intervals for treatment effects, and an interval for a difference that includes zero means the result is not statistically significant at that level. In US high schools, Common Core standard S-IC.B.4 asks students to estimate a population mean or proportion with a margin of error. To plan how many people to survey, use the sample size calculator; for the spread of your data, the standard deviation calculator; and for single values, the z-score calculator.
How this calculator works
- Interval = mean ± critical value × (s ÷ √n).
- For samples under 30, uses the t critical value with n − 1 degrees of freedom; for 30 or more, the normal (z) critical value.
- Shows the standard error, the margin of error and the lower and upper bounds.
- Assumes a random sample and roughly normal data or a large enough sample.
Frequently asked questions
How do I calculate a 95% confidence interval?
Find the standard error s ÷ √n, multiply by 1.96 (or the t value for small samples) to get the margin of error, then add and subtract it from the sample mean.
What does a 95% confidence interval mean?
If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true population mean.
When should I use t instead of z?
Use the t distribution when the population SD is unknown and the sample is small (under about 30). For large samples, t and z give nearly the same result.
What is the margin of error?
Half the width of the confidence interval: the critical value multiplied by the standard error.
What z-score is used for a 90% confidence interval?
1.645.
How does sample size affect a confidence interval?
The margin of error shrinks with the square root of n. Four times as many observations halve the width of the interval.
Can I calculate a confidence interval without the standard deviation?
You need some measure of spread. If you have the raw data, calculate the SD first with the standard deviation calculator.
Is a 99% confidence interval wider than a 95% one?
Yes. Being more confident requires a larger critical value (2.576 instead of 1.96), so the interval is wider.