Confidence Interval Calculator
Enter a sample mean, standard deviation and sample size, or a count of successes, and pick a confidence level. You get the interval, the margin of error and every step of the formula.
Common choices: 90, 95, 99
e.g. people who answered yes
How to use the Confidence Interval Calculator
- Choose Mean or Proportion depending on what you are estimating.
- Enter the confidence level, usually 95%.
- Enter your sample statistics: mean, standard deviation and n, or successes and n.
- Pick t or z (for means) or Wald or Wilson (for proportions).
- Read the interval and the margin of error, and check the steps and the table of other confidence levels.
Confidence interval formulas
Mean (σ unknown): x̄ ± t* × s / √n, with t* from the t distribution with n − 1 degrees of freedom.
Mean (σ known): x̄ ± z* × σ / √n.
Proportion (Wald): p̂ ± z* × √(p̂(1 − p̂) / n).
Proportion (Wilson score): [p̂ + z²/2n ± z √(p̂(1 − p̂)/n + z²/4n²)] / (1 + z²/n).
Example: a sample of 36 has mean 50 and standard deviation 8. SE = 8 / 6 = 1.333, t* (35 df, 95%) = 2.030, so the margin of error is 2.707 and the 95% interval is 47.29 to 52.71.
Common critical values
| Confidence | z* | t* (df = 5) | t* (df = 10) | t* (df = 30) |
|---|---|---|---|---|
| 80% | 1.282 | 1.476 | 1.372 | 1.310 |
| 90% | 1.645 | 2.015 | 1.812 | 1.697 |
| 95% | 1.960 | 2.571 | 2.228 | 2.042 |
| 98% | 2.326 | 3.365 | 2.764 | 2.457 |
| 99% | 2.576 | 4.032 | 3.169 | 2.750 |
| 99.9% | 3.291 | 6.869 | 4.587 | 3.646 |
Need to plan a survey instead? The sample size calculator works the formula backwards from the margin of error you want.
Frequently asked questions
What is a confidence interval?
A confidence interval is a range of plausible values for an unknown population value, such as a mean or a proportion, built from sample data. A 95% interval comes from a method that captures the true value in 95% of repeated samples.
How do you calculate a 95% confidence interval for a mean?
Compute the standard error s / √n, multiply it by the critical value (1.96 for z, or the t value with n − 1 degrees of freedom) to get the margin of error, then take the mean plus and minus that margin.
Should I use t or z?
Use t when the standard deviation comes from your sample, which is almost always the case. Use z only when the population standard deviation is genuinely known. For large samples the two give nearly the same answer.
What is the margin of error?
The margin of error is half the width of the confidence interval: the critical value times the standard error. A poll reporting 52% ± 3% has a margin of error of 3 percentage points.
What is the difference between the Wald and Wilson intervals?
The Wald interval is p̂ ± z·√(p̂(1−p̂)/n), the textbook formula. The Wilson score interval adjusts the centre and width and stays accurate for small samples or proportions near 0% or 100%, where Wald performs poorly.
Why does a higher confidence level give a wider interval?
To be more confident of capturing the true value you need a larger critical value, for example 2.576 at 99% instead of 1.96 at 95%, so the margin of error and the interval grow.
Does a 95% interval mean there is a 95% chance the true value is inside it?
Strictly no. The true value is fixed; the 95% describes the long-run success rate of the method. In practice it is read as a range you can be 95% confident contains the true value.