By Tim King · Updated
Confidence Interval Calculator for a Mean
t or z Interval for a Mean at 90, 95 or 99 Percent
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Confidence Interval Calculator works
This confidence interval calculator gives the range that is likely to contain the true population mean. Enter your sample mean, standard deviation and sample size, choose a confidence level and it returns the interval, the margin of error, the standard error and the critical value it used.
A sample mean is only an estimate. Take a different sample and you would get a slightly different number. A confidence interval puts a margin around the estimate that reflects that uncertainty: a 95% interval is built by a method that captures the true mean in 95 out of every 100 samples.
How the confidence interval calculator works
The formula is mean ± critical value × SE, where the standard error SE = s ÷ √n. With a sample standard deviation the critical value comes from the t distribution with n − 1 degrees of freedom; when the population SD is known it comes from the normal distribution instead.
First example. Twenty-five parcels average 50 kg with s = 8. SE = 8 ÷ 5 = 1.6, t = 2.064, so the 95% interval is 50 ± 3.30, or 46.7 to 53.3 kg.
Second example. With n = 100 and the same mean and SD, SE falls to 0.8 and the interval narrows to 48.4 to 51.6 kg.
How many more samples halve the interval? Four times as many, because the width shrinks with the square root of n.
Critical values for 90%, 95% and 99% confidence intervals by sample size
| Sample size n | t for 90% | t for 95% | t for 99% |
|---|---|---|---|
| 2 | 6.314 | 12.706 | 63.657 |
| 3 | 2.920 | 4.303 | 9.925 |
| 4 | 2.353 | 3.182 | 5.841 |
| 5 | 2.132 | 2.776 | 4.604 |
| 6 | 2.015 | 2.571 | 4.032 |
| 7 | 1.943 | 2.447 | 3.707 |
| 8 | 1.895 | 2.365 | 3.499 |
| 9 | 1.860 | 2.306 | 3.355 |
| 10 | 1.833 | 2.262 | 3.250 |
| 12 | 1.796 | 2.201 | 3.106 |
| 15 | 1.761 | 2.145 | 2.977 |
| 20 | 1.729 | 2.093 | 2.861 |
| 25 | 1.711 | 2.064 | 2.797 |
| 30 | 1.699 | 2.045 | 2.756 |
| 40 | 1.685 | 2.023 | 2.708 |
| 50 | 1.677 | 2.010 | 2.680 |
| 60 | 1.671 | 2.001 | 2.662 |
| 80 | 1.664 | 1.990 | 2.640 |
| 100 | 1.660 | 1.984 | 2.626 |
| 120 | 1.658 | 1.980 | 2.618 |
| 200 | 1.653 | 1.972 | 2.601 |
| 500 | 1.648 | 1.965 | 2.586 |
| 1,000 | 1.646 | 1.962 | 2.581 |
| ∞ (z) | 1.645 | 1.960 | 2.576 |
Tips
- Use t unless you truly know σ. Almost every real data set gives you a sample SD, not the population one.
- Wider is safer. A 99% interval is wider than a 95% one; you trade precision for confidence.
- Small samples need roughly normal data. Above about 30 the t interval is robust to skew.
FAQ
What does a 95% confidence interval actually mean?
It means the method used to build the interval captures the true population mean 95% of the time across repeated samples. It does not mean there is a 95% probability that this particular interval contains the mean; once calculated, the interval either contains it or it does not.
When should I use z instead of t?
Use z only when the population standard deviation is genuinely known, for example from a long run of quality-control data. If you calculated the SD from the same sample, use t. With samples over a hundred the two give nearly identical intervals anyway, so the choice matters most for small n.
How do I make a confidence interval narrower?
Collect a larger sample, accept a lower confidence level, or reduce the variability in your measurements. Sample size is the most reliable lever: quadrupling n halves the width, because the standard error falls with the square root of the sample size.
What is the difference between standard error and standard deviation?
The standard deviation measures how spread out the individual values are. The standard error measures how precisely the sample mean estimates the population mean, and equals the SD divided by the square root of n. It shrinks as the sample grows; the SD does not.
See also: all Statistics tools, Arithmetic, Number Theory, Algebra and Geometry, Trigonometry and Calculus.
Related tools
Margin Of Error Calculator
Plus-or-minus for a poll or survey result.
Sample Size Calculator
How many responses a survey needs.
Z-Score Calculator
Z-score, percentile and tail areas from a value, mean and SD.
Standard Deviation Calculator
Sample and population standard deviation and variance of a list.
Normal Distribution Calculator
Areas under any bell curve, and values at a percentile.