Confidence Interval Calculator
Enter a sample mean, SD and size, or a count of successes, and this confidence interval calculator returns the interval and its margin of error at any confidence level, with t when the SD comes from the sample and Wilson for a proportion.
95% confidence interval
- 95% confidence interval 50 ± 3.30: the estimate plus and minus the margin of error.
- 46.70 to 53.30
- Margin of error t x SE = 2.0639 x 1.6. Halving it takes four times the sample, because the standard error shrinks with the square root of n.
- ± 3.30
- Critical value Student's t with 95% between -t and t on n - 1 = 24 degrees of freedom. Wider than z to pay for estimating the SD from the same sample.
- t = 2.0639 on 24 df
- Standard error 8 / sqrt 25: how much a sample mean of this size varies from sample to sample.
- 1.6
- With z instead of t Margin ± 3.14, 5.04% narrower. Too narrow for a sample SD: it ignores the uncertainty in the SD itself. The gap closes as n grows.
- 46.86 to 53.14
| Confidence | Critical value | Margin of error | Interval |
|---|---|---|---|
| 80% | 1.3178 | ± 2.11 | 47.89 to 52.11 |
| 90% | 1.7109 | ± 2.74 | 47.26 to 52.74 |
| 95% | 2.0639 | ± 3.30 | 46.70 to 53.30 |
| 98% | 2.4922 | ± 3.99 | 46.01 to 53.99 |
| 99% | 2.7969 | ± 4.48 | 45.52 to 54.48 |
- 95% describes the method: across many samples, 95% of intervals built this way contain the true mean. Any one interval either contains it or does not.
- The t interval assumes the data are roughly normal or the sample is large enough for the mean to be. A few extreme values in a small sample can throw it off.
How the Confidence Interval Calculator works
A confidence interval is an estimate with its uncertainty attached: a range built so that, across many samples, a stated share of such ranges contain the true value. Every interval here has the same shape, estimate ± critical value × standard error, and the margin of error is the part after the ±.
For a mean, the standard error is the standard deviation divided by √n. If the population SD is known in advance, the critical value comes from the normal curve: 1.645 at 90%, 1.96 at 95% and 2.576 at 99%. At 95%, the level this confidence interval calculator starts at, that is the familiar 1.96. Usually the SD comes from the same sample, and then the critical value comes from Student's t on n - 1 degrees of freedom, which is larger to pay for estimating the spread.
Take a sample of 25 with mean 50 and SD 8. The standard error is 8 / √25 = 1.6. The t value on 24 degrees of freedom is 2.0639, so the margin of error is 2.0639 × 1.6 = 3.30 and the 95% interval runs from 46.70 to 53.30. Using z in place of t would give 46.86 to 53.14, a little too narrow.
For a proportion there are two common formulas. The Wald interval, p̂ ± z√(p̂(1 - p̂)/n), is the one most textbooks teach first. The Wilson score interval is the better choice, and this calculator uses it by default. Wald's real coverage falls short of its stated level when the proportion is near 0% or 100% or the sample is small. It gives an interval of zero width when there are no successes, and it can run below 0%. Wilson stays inside 0 to 100% and holds close to its level. The gap can be computed exactly: with 20 trials and a true proportion of 10%, a 95% Wald interval contains the truth 87.60% of the time and a 95% Wilson interval 95.68%. In the middle they nearly agree. For 50 successes out of 100, Wilson gives 40.38% to 59.62% and Wald gives 40.20% to 59.80%.
The 95% describes the method. Across many samples, 95% of intervals built this way contain the true value; any one interval either contains it or misses. A narrower interval needs a bigger sample. The margin of error shrinks with √n, so halving it takes four times the data, and the sample size calculator works that out before you collect anything.
Confidence Interval Calculator FAQ
How do you calculate a 95% confidence interval?
Add and subtract the margin of error from the estimate. The margin is the critical value times the standard error: 1.96 standard errors when the population SD is known, or t on n - 1 degrees of freedom when the SD comes from the sample. For a mean of 50, SD 8 and n = 25 that is 50 ± 2.0639 × 1.6, or 46.70 to 53.30.
When should I use t instead of z?
Whenever the standard deviation was computed from the same sample, which is nearly always. z is for a population SD known in advance. The two converge as n grows: on 24 degrees of freedom the 95% t value is 2.0639 against z's 1.96.
Which is better for a proportion, Wilson or Wald?
Wilson. Wald's coverage drops below the stated level near 0% or 100% and in small samples, it collapses to zero width with no successes, and it can run below 0%. Wilson stays inside 0 to 100% and keeps close to its level. With 20 trials and a true rate of 10%, a 95% Wald interval covers the truth 87.60% of the time against Wilson's 95.68%.
What is the margin of error?
Half the width of the interval: the critical value times the standard error. For a poll of 1,000 people split 50/50, the 95% margin of error is 1.96 × √(0.25 / 1,000), about ±3.1 percentage points.
Does a 95% confidence interval mean a 95% chance the true value is inside?
Strictly, no. The 95% is a property of the method: 95% of intervals built this way, over many samples, contain the true value. Once a particular interval is computed, it either contains the value or misses it. Reading it as a 95% probability needs a Bayesian credible interval and a prior.