Confidence Interval Calculator
Confidence Interval = mean ± (critical value × standard error). Enter your data and the calculator picks the right critical value, t or z, and shows the margin of error, the interval, and every step.
A confidence interval gives you a range where the true population mean most likely sits, based on your sample. The formula is short: confidence interval = mean ± (critical value × standard error). Enter your sample mean, standard deviation, and sample size above, pick a confidence level, and the calculator returns the interval, the margin of error, the critical value it used, and every step in between. Below you will find the exact formula, the z and t values for 90%, 95%, and 99%, and worked examples using real numbers so you can check your own homework line by line.
What is a confidence interval?
A confidence interval is a range of values, built from sample data, that is likely to contain the true population mean. A 95% confidence interval means that if you repeated the same study many times, about 95 out of every 100 intervals you built this way would capture the real mean. It does not mean there is a 95% chance the mean is inside your one specific interval. The interval is fixed once you calculate it; the confidence refers to the long-run method, not the single result.
Every confidence interval has three moving parts: a point estimate (your sample mean), a critical value (z or t, set by the confidence level), and the standard error (how much your sample mean is expected to bounce around). Put them together and you get a lower bound and an upper bound.
What is the confidence interval formula?
The core formula is the same whether you use z or t:
CI = x̄ ± (critical value × standard error)
where standard error = s ÷ √n
Written out fully, the interval runs from the lower bound to the upper bound:
- Lower bound = x̄ − (critical value × s ÷ √n)
- Upper bound = x̄ + (critical value × s ÷ √n)
Here x̄ is the sample mean, s is the sample standard deviation, and n is the sample size. The piece in the parentheses, critical value × standard error, is the margin of error. The whole interval is just the mean plus or minus that margin.
How do you calculate a confidence interval step by step?
Take a sample with mean 50, standard deviation 5, and 10 observations, at a 95% confidence level. Since the sample is small (under 30) and the population standard deviation is unknown, you use the t distribution.
- Find the standard error. SE = 5 ÷ √10 = 5 ÷ 3.1623 = 1.5811.
- Find the degrees of freedom. df = n − 1 = 10 − 1 = 9.
- Look up the critical value. The t value at 95% with df = 9 is 2.262.
- Calculate the margin of error. MOE = 2.262 × 1.5811 = 3.5765.
- Build the interval. 50 − 3.5765 = 46.42 and 50 + 3.5765 = 53.58.
The 95% confidence interval is (46.42, 53.58). You can be 95% confident the true mean falls in that range. The 1.96 in that calculation is not arbitrary, and where the critical value comes from explains how it is picked for any confidence level.
When do you use z instead of t?
The choice comes down to what you know and how big your sample is.
| Situation | Use | Why |
|---|---|---|
| Population standard deviation known | z | No extra uncertainty from estimating spread |
| Population SD unknown, sample under 30 | t | Small samples need wider intervals to stay honest |
| Population SD unknown, sample 30 or more | z (or t) | t and z are nearly identical at this size |
In most real coursework the population standard deviation is unknown, so the t distribution is the safe default for small samples. As the sample grows past 30, the t value shrinks toward the z value and the two give almost the same interval.
What are the z values for 90%, 95%, and 99% confidence?
When you use the z distribution (large sample or known population SD), the critical value depends only on the confidence level, not the sample size. These are the numbers people search for most:
| Confidence level | z critical value |
|---|---|
| 80% | 1.282 |
| 90% | 1.645 |
| 95% | 1.960 |
| 98% | 2.326 |
| 99% | 2.576 |
| 99.9% | 3.291 |
So the three you will use again and again are 1.645 for 90%, 1.96 for 95%, and 2.576 for 99%. A higher confidence level uses a larger z value, which makes the interval wider. More confidence costs you precision.
What are the t values for 95% confidence?
For small samples the critical value changes with the degrees of freedom (n − 1). Here are the t values at 95% confidence for common sample sizes:
| Sample size (n) | Degrees of freedom (df) | t value (95%) |
|---|---|---|
| 5 | 4 | 2.776 |
| 10 | 9 | 2.262 |
| 15 | 14 | 2.145 |
| 20 | 19 | 2.093 |
| 25 | 24 | 2.064 |
| 30 | 29 | 2.045 |
Notice how the t value drops as the sample grows, moving closer to the z value of 1.96. That is the t distribution catching up to the normal curve. For a full reference, our t table lists every df and confidence level, and the z table covers the standard normal values.
How do you find a confidence interval from raw data?
If you have the actual numbers instead of a summary, the calculator finds the mean and standard deviation for you. Take this data set: 12, 15, 14, 20, 18, 16, 13, 17.
- Mean: the eight values sum to 125, so x̄ = 125 ÷ 8 = 15.625.
- Sample standard deviation: s = 2.669 (using n − 1 in the denominator).
- Standard error: SE = 2.669 ÷ √8 = 0.9437.
- Critical value: df = 7, so the t value at 95% is 2.365.
- Margin of error: 2.365 × 0.9437 = 2.2319.
- Interval: 15.625 ± 2.2319 gives (13.39, 17.86).
Switch the calculator to raw data mode, paste your numbers, and it runs all six steps automatically. The standard error calculator can break down that middle step on its own if you want to check it.
How do you calculate a 95% confidence interval with a large sample?
With a big sample you use z. Say the mean is 100, the standard deviation is 15, and n is 50, at 95% confidence.
- Standard error: SE = 15 ÷ √50 = 2.1213.
- Critical value: z at 95% = 1.96 (no degrees of freedom needed for z).
- Margin of error: 1.96 × 2.1213 = 4.1578.
- Interval: 100 ± 4.1578 gives (95.84, 104.16).
Larger samples shrink the standard error, which tightens the interval. Double the sample size and the margin of error drops by roughly a third, because the square root of n sits in the denominator.
What does a 95% confidence interval actually mean?
Say your 95% interval for a mean is (46.42, 53.58). The correct reading: if you drew a fresh sample and rebuilt the interval many times over, about 95% of those intervals would contain the true population mean. It is a statement about the reliability of the method across many samples, not a probability about your one interval.
The common mistake is saying “there is a 95% chance the true mean is between 46.42 and 53.58.” Once the interval is calculated, the true mean is either inside it or it is not. The 95% describes how often this procedure succeeds, not the odds for a single case.
How can you make a confidence interval narrower?
A tighter interval is a more precise estimate. Three levers control the width:
- Increase the sample size. A bigger n shrinks the standard error, which is the biggest lever you control.
- Lower the confidence level. A 90% interval is narrower than a 95% one because the critical value is smaller. You trade confidence for precision.
- Reduce variability. A smaller standard deviation, if the data allows it, tightens the interval, though this is usually fixed by the data itself.
Sample size is the honest lever. Dropping the confidence level narrows the interval, but it also makes you less sure the true mean is inside it.
Common confidence interval mistakes to avoid
- Using z for a tiny sample. With n under 30 and an unknown population SD, z gives an interval that is too narrow. Use t.
- Mixing up standard deviation and standard error. The standard deviation measures spread in the data; the standard error measures spread in the sample mean. The formula uses standard error.
- Forgetting degrees of freedom. For t, df = n − 1. Reading the t value at the wrong df gives the wrong margin of error.
- Misreading the meaning. The interval is about the method’s long-run success rate, not the probability for your single interval.
If your work involves testing a claim rather than estimating a range, pair this with the hypothesis testing calculator, which uses the same critical values in a different way.