๐ Confidence Interval Calculator for a Mean
By Shihab Mia ยท Updated 2026-07-03
Enter your sample statistics to estimate the range that likely contains the true population mean.
This confidence interval calculator gives you a range of plausible values for the true population mean from a single sample, so you can report a result honestly instead of pretending one number is exact. Enter your sample mean, standard deviation and sample size, choose a confidence level (90, 95 or 99 percent), and it returns the margin of error together with the lower and upper bounds instantly. A confidence interval pairs those bounds with a confidence level that tells you how often intervals built this way would capture the real mean.
What is the Confidence Interval Calculator?
A confidence interval turns a single sample estimate into an honest range. When you measure a sample, the sample mean almost never equals the true population mean exactly, because of random sampling variation. This confidence interval calculator expresses that uncertainty for you: it says the true mean is plausibly somewhere between a lower bound and an upper bound, given the spread in your data and how many observations you collected. Reporting the interval instead of a bare average is what separates a careful analysis from a misleading one.
The interval is built as the sample mean plus or minus a margin of error, and the margin of error has two parts. The first is the standard error, s divided by the square root of n, which shrinks as your sample grows because larger samples pin down the mean more tightly. The second is a critical value, the z score, that comes from the confidence level. A higher confidence level uses a larger z, so demanding 99 percent confidence produces a wider interval than 90 percent. There is always a trade off: more confidence means less precision, and this confidence interval calculator lets you see that trade off by switching the level.
The confidence level is the single most misread idea in the whole topic. A 95 percent confidence interval does not mean there is a 95 percent probability that this one interval contains the true mean. The true mean is a fixed number; this particular interval either contains it or it does not. What 95 percent describes is the long run method: if you repeated the whole sampling procedure many times and built an interval each time, about 95 percent of those intervals would capture the true mean. The confidence is in the procedure, not in any single result, and that distinction matters whenever you present a 95 percent confidence interval to a decision maker.
The margin of error deserves its own attention because people report it loosely. In this z score confidence interval, the margin of error is z times the standard error, and it is the half width of the interval, not the full width. When a news poll says plus or minus 3 points, that 3 is the margin of error; the full interval spans 6 points. A margin of error calculator and a confidence interval calculator are really the same tool viewed from two angles, since the bounds are just the mean shifted by that margin in each direction.
This confidence interval calculator uses the z based formula, which assumes you either know the population standard deviation or have a large enough sample (a common rule of thumb is n of 30 or more) for the normal approximation to hold. For small samples where the standard deviation is estimated from the data, statisticians use the t distribution instead, which has slightly wider intervals to account for that extra uncertainty. A confidence level calculator built on t would ask for degrees of freedom; the z version here needs only the mean, the standard error and your chosen confidence level. For most everyday survey and measurement work with a healthy sample size, the z based mean confidence interval shown here is accurate and standard.
A final practical note: a confidence interval only fixes uncertainty from random sampling. It does nothing about bias. If your sample is not representative, if measurement is systematically off, or if respondents self select, a beautifully narrow 95 percent confidence interval can still sit far from the truth. Use this confidence interval calculator to quantify sampling noise, but design the sample itself with just as much care.
When to use it
- Reporting survey results, such as an average satisfaction score, with an honest margin of error rather than a single point estimate.
- Quality control: estimating the true average weight, length or fill volume of a production run from a sample of units using a mean confidence interval.
- Summarising experiment or A/B test data where you need the plausible range for a measured average, not just the observed mean.
- Comparing two groups: overlapping confidence intervals hint that a difference may not be statistically meaningful, guiding whether to test further.
- Coursework and exams in statistics, where you must compute a 90, 95 or 99 percent confidence interval and show the margin of error and standard error.
- Communicating research or business metrics to stakeholders who need to see uncertainty, not a falsely precise headline number.
How to use the Confidence Interval Calculator
- Enter the sample mean (the average you calculated from your data).
- Enter the sample standard deviation s and the sample size n.
- Choose a confidence level of 90, 95 or 99 percent from the dropdown.
- Let the confidence interval calculator compute the standard error and the margin of error automatically.
- Read off the lower and upper bounds, then copy the interval if you need it for a report.
Formula & method
Worked examples
A sample of 36 light bulbs has a mean life of 100 hours with a standard deviation of 15 hours. Find the 95 percent confidence interval for the true mean life.
- Identify the inputs: mean = 100, s = 15, n = 36, confidence = 95% so z = 1.960.
- Standard error = s / sqrt(n) = 15 / sqrt(36) = 15 / 6 = 2.5.
- Margin of error = z times standard error = 1.960 times 2.5 = 4.9.
- Lower bound = 100 minus 4.9 = 95.1; upper bound = 100 plus 4.9 = 104.9.
Result: 95% CI = 100 plus or minus 4.9 = [95.1, 104.9] hours.
A poll of 400 people gives a mean weekly spend of 50 dollars with a standard deviation of 20 dollars. Find the 99 percent confidence interval.
- Inputs: mean = 50, s = 20, n = 400, confidence = 99% so z = 2.576.
- Standard error = 20 / sqrt(400) = 20 / 20 = 1.
- Margin of error = 2.576 times 1 = 2.576.
- Lower bound = 50 minus 2.576 = 47.424; upper bound = 50 plus 2.576 = 52.576.
Result: 99% CI = 50 plus or minus 2.576 = [47.42, 52.58] dollars (rounded).
A lab records a mean reaction time of 250 ms with a standard deviation of 40 ms across 64 trials. Find the 90 percent confidence interval.
- Inputs: mean = 250, s = 40, n = 64, confidence = 90% so z = 1.645.
- Standard error = 40 / sqrt(64) = 40 / 8 = 5.
- Margin of error = 1.645 times 5 = 8.225.
- Lower bound = 250 minus 8.225 = 241.775; upper bound = 250 plus 8.225 = 258.225.
Result: 90% CI = 250 plus or minus 8.23 = [241.78, 258.23] ms (rounded).
Common z critical values by confidence level (two sided)
| Confidence level | z critical value | Relative width |
|---|---|---|
| 80% | 1.282 | Narrowest |
| 90% | 1.645 | Narrow |
| 95% | 1.960 | Standard |
| 98% | 2.326 | Wide |
| 99% | 2.576 | Widest |
How sample size shrinks the margin of error (s = 15, 95% confidence)
| Sample size n | Standard error (s / sqrt(n)) | Margin of error (z times SE) |
|---|---|---|
| 9 | 5.000 | 9.80 |
| 36 | 2.500 | 4.90 |
| 100 | 1.500 | 2.94 |
| 400 | 0.750 | 1.47 |
| 900 | 0.500 | 0.98 |
z versus t critical value at 95% confidence (why small samples differ)
| Sample size n | Degrees of freedom | t critical (95%) | z critical (95%) |
|---|---|---|---|
| 5 | 4 | 2.776 | 1.960 |
| 10 | 9 | 2.262 | 1.960 |
| 30 | 29 | 2.045 | 1.960 |
| 100 | 99 | 1.984 | 1.960 |
| Large | Infinite | 1.960 | 1.960 |
Common mistakes to avoid
- Reading the confidence level as a probability for one interval. A 95 percent confidence interval does not mean a 95 percent chance the true mean is inside this specific range. The 95 percent refers to the method over many repeated samples, not to a single computed interval.
- Using standard deviation instead of standard error. The margin of error uses the standard error s / sqrt(n), not the raw standard deviation s. Forgetting to divide by the square root of n produces an interval that is far too wide.
- Picking the wrong critical value for the confidence level. Each confidence level has its own z value (90% is 1.645, 95% is 1.960, 99% is 2.576). Mixing them up, for example using 1.96 for a 99 percent interval, gives a margin of error that is too small.
- Using z for a tiny sample. The z based interval assumes a large sample or a known population standard deviation. For small samples with an estimated standard deviation, the t distribution is more accurate and gives a slightly wider, more honest interval.
- Confusing the margin of error with the full interval width. The margin of error is the half width. A plus or minus 3 result spans a full 6 point interval. Reporting the margin as if it were the whole range understates the uncertainty by half.
- Trusting a narrow interval from a biased sample. A confidence interval only accounts for random sampling error. If the sample is not representative or measurement is systematically off, the interval can be tight yet centred on the wrong value.
Glossary
- Confidence interval
- A range of plausible values for an unknown population parameter, here the mean, built from sample data and a chosen confidence level.
- Confidence level
- The long run percentage of intervals, built by this same procedure, that would contain the true mean. Common choices are 90, 95 and 99 percent.
- Margin of error
- The plus or minus amount added to and subtracted from the sample mean. It equals the critical value times the standard error and is the half width of the interval.
- Standard error
- The standard deviation of the sample mean, computed as s divided by the square root of n. It measures how much the sample mean is expected to vary from sample to sample.
- Critical value (z)
- A multiplier from the standard normal distribution that corresponds to the chosen confidence level, such as 1.960 for 95 percent.
- Sample size (n)
- The number of observations in your sample. A larger n shrinks the standard error and produces a narrower interval.
- Point estimate
- A single best guess for the parameter, here the sample mean. The confidence interval surrounds the point estimate with a range that reflects uncertainty.
- t distribution
- A bell shaped distribution with heavier tails than the normal, used for small samples where the standard deviation is estimated. It produces slightly wider intervals.
Frequently asked questions
What is a confidence interval in simple terms?
It is a range that likely contains the true average for a whole population, estimated from one sample. Rather than reporting a single number, you report a lower bound, an upper bound and how confident the method is, for example 95 percent.
What z value should I use for a 95 percent confidence interval?
Use z = 1.960 for a 95 percent confidence interval. For 90 percent use 1.645, and for 99 percent use 2.576. These come from the standard normal distribution for a two sided interval.
How do I calculate the margin of error?
Multiply the critical value by the standard error: margin of error = z times (s divided by the square root of n). The standard error is the sample standard deviation divided by the square root of the sample size.
Why does a higher confidence level give a wider interval?
A higher confidence level uses a larger z value, which multiplies the standard error by more. To be more certain that the interval captures the true mean, you have to make the interval wider, so there is a trade off between confidence and precision.
Should I use the z distribution or the t distribution?
Use z when the population standard deviation is known or the sample is large (often n of 30 or more). Use the t distribution for small samples where the standard deviation is estimated from the data, because it gives slightly wider, more cautious intervals.
How can I make a confidence interval narrower?
Collect a larger sample, since the standard error falls with the square root of n. You can also lower the confidence level, for example from 99 to 90 percent, or reduce variability in the data, though a bigger sample is usually the most reliable option.
What is the difference between margin of error and the confidence interval?
The margin of error is the plus or minus half width; the confidence interval is the full range from lower to upper bound. The interval equals the sample mean minus the margin up to the sample mean plus the margin.
Does a 95 percent confidence interval mean 95 percent of my data falls inside it?
No. A confidence interval is about the mean, not individual data points. It estimates where the true average lies. The range that captures a given percentage of individual values is a different idea called a prediction or tolerance interval.
What does it mean when two confidence intervals overlap?
Overlapping intervals for two group means suggest the difference may not be statistically significant, though this is only a rough guide. To be sure, run a formal test on the difference rather than eyeballing the overlap.
Can I use this calculator for a proportion or percentage?
This tool is built for the mean of a numeric variable. Confidence intervals for a proportion use a different standard error, the square root of p times (1 minus p) divided by n, so use a dedicated proportion calculator for percentages.