Confidence Interval Calculator
Test cases replayed : 4 of 4 match · Methodology · No outside source listed
Enter the sample mean, standard deviation and size, and pick a confidence level, to get the interval and its margin of error.
Result
Lower bound
Upper bound
- Critical value (t* or z*)
- Standard error (s ÷ √n)
- Margin of error
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Sample mean (x̄): enter a number.
- Standard deviation (s, or σ if known): enter 0 or more.
- Sample size (n): enter 2 or more.
- Confidence level: choose one of the 6 options in the list.
- Method: choose t interval (standard deviation from the sample) or z interval (population σ known).
- Read the result: Lower bound; the panel also shows Critical value (t* or z*), Standard error (s ÷ √n), Margin of error and Upper bound.
How this calculator works
Interval = x̄ ± critical value × s ÷ √n. With the standard deviation from the sample, the critical value is t* from Student's t distribution with n − 1 degrees of freedom; when the population σ is known, it is z* from the standard normal distribution.
z* and t* are found by inverting the normal and Student's t distribution functions numerically (bisection). Results are rounded to 3 decimals.
Common z* values: 1.645 for 90%, 1.960 for 95%, 2.576 for 99%.
The formula
| Symbol | Meaning |
|---|---|
| Sample mean | |
| Standard deviation (s, or σ if known) | |
| Sample size | |
| Confidence level | |
| Method (1: t interval (standard deviation from the sample); 2: z interval (population σ known)) | |
| Standard error (s ÷ √n) | |
| Lower bound | |
round(x, d) | x rounded to d decimal places, or to a whole number without d. |
tinv(p, d) | the value that a Student's t variable with d degrees of freedom stays at or below with probability p. |
norminv(p, m, s) | the value that a Gaussian variable with mean m and standard deviation s stays at or below with probability p (mean zero and standard deviation one without m and s). |
Worked example
| Sample mean (x̄) | 50 |
|---|---|
| Standard deviation (s, or σ if known) | 8 |
| Sample size (n) | 25 |
| Confidence level | 95% |
| Method | t interval (standard deviation from the sample) |
| Critical value (t* or z*) | 2.064 |
|---|---|
| Standard error (s ÷ √n) | 1.6 |
| Margin of error | 3.302 |
| Upper bound | 53.302 |
Lower bound 46.698
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is the 95% confidence interval for a mean of 50, SD 8 and n = 25?
t* = 2.064 with 24 degrees of freedom, the standard error is 8 ÷ 5 = 1.6, so the interval is 46.698 to 53.302.
What does a 95% confidence interval mean?
If you repeated the sampling many times, about 95% of the intervals built this way would contain the true mean. It is not a 95% chance for this one interval.
Why is the 99% interval wider than the 95% one?
More confidence needs a larger critical value (2.576 instead of 1.960 for z), which widens the margin of error.