How to Calculate a Confidence Interval (2026)
By Rui Barreira · Last updated: 18 June 2026
A confidence interval (CI) gives you a range of values, calculated from sample data, that is likely to contain the true population parameter. A 95% CI means that if you repeated your sampling procedure 100 times, roughly 95 of those intervals would contain the true value. It does not mean there is a 95% chance the true value falls in this specific interval — but in practice, interpreting it that way is a useful working approximation.
The formula and what goes into it
For a sample mean with known standard deviation, the confidence interval is:
CI = x̄ ± z × (σ / √n)
Where x̄ is the sample mean, z is the critical value for your confidence level, σ is the standard deviation, and n is the sample size. The term σ / √n is the standard error — it measures how much the sample mean is expected to vary. A larger sample size shrinks the standard error, producing a narrower (more precise) interval.
When population standard deviation is unknown (the typical case), replace z with the t-statistic and use sample standard deviation instead. The t-distribution has heavier tails, which widens the interval to account for the added uncertainty.
Critical values by confidence level
The z-value (or t-value for small samples) is determined by how confident you want to be. More confidence requires a wider interval.
| Confidence Level | z-value (large n) | Typical use |
|---|---|---|
| 90% | 1.645 | Exploratory analysis, informal reporting |
| 95% | 1.960 | Standard default in most research and A/B testing |
| 99% | 2.576 | Medical trials, safety-critical decisions |
| 99.9% | 3.291 | High-stakes manufacturing quality control |
A worked example
You survey 50 customers and measure average session time: mean 4.2 minutes, standard deviation 1.1 minutes. To build a 95% CI:
Standard error = 1.1 / √50 ≈ 0.156. Margin of error = 1.960 × 0.156 ≈ 0.305. CI = 4.2 ± 0.305 → [3.90, 4.51] minutes.
If you wanted to halve that margin of error, you would need to quadruple your sample size — increasing n from 50 to 200. This is the practical tradeoff between precision and data collection cost that confidence intervals make explicit.
Use the Confidence Interval calculator to skip the arithmetic and get the interval, standard error, and margin of error instantly.
Frequently Asked Questions
- Is this tool free?
- Yes — completely free, no signup required. All processing happens in your browser.
- Does the tool work offline?
- Once loaded, most features work without an internet connection since everything runs client-side.