Confidence Interval Calculator
A confidence interval for a mean from the sample mean, standard deviation and size — with the standard error and margin of error shown.
The interval is x̄ ± z × s ÷ √n.
How the confidence interval calculator works
The interval is x̄ ± z × s ÷ √n. The standard error s ÷ √n shrinks with the square root of the sample size, so four times the data halves the interval. For samples under 30 the t-distribution gives a slightly wider interval; the calculator uses z and says so.
Formula: CI = x̄ ± z · s / √n
Worked examples
| Inputs | Confidence interval | Note |
|---|---|---|
| mean 72, s 8, n 50, 95% | 69.7825 to 74.2175 | 69.78 to 74.22 |
| n 200 | 70.8913 to 73.1087 | half as wide |
| 99% | 69.0858 to 74.9142 | wider |
FAQFrequently asked questions
What does 95% confidence mean?
If you repeated the sampling many times, 95% of the intervals built this way would contain the true mean.
How do I make the interval narrower?
Collect more data (width falls with √n), accept lower confidence, or reduce variability.
When should I use t instead of z?
For small samples (under about 30) when the population SD is unknown; the difference fades as n grows.
Is this the same as a margin of error in a poll?
The same idea for a proportion: ±z√(p(1−p)/n).
Does a 95% interval contain 95% of the data?
No — it is about where the mean is, not the spread of individual values.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Common Core State Standards — Mathematics — the terms and methods taught in US schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.