A single number — "the average customer spends 42 dollars" — hides something important: how sure are you? A confidence interval turns that point estimate into a range, like "42 plus or minus 3.1 dollars," and attaches a confidence level to it. That range is what you should quote in a report, a dashboard, or an A/B test summary, because it communicates both the estimate and the uncertainty behind it in one line.
This calculator builds a confidence interval for a population mean from four inputs: your sample mean, the sample standard deviation, the sample size, and a confidence level (90%, 95%, 98%, or 99%). It returns the margin of error and the full interval. Everything computes locally in your browser the moment you type — free, no signup, and nothing you enter leaves your device.
Below you will find the formula, the exact critical values used for each confidence level, worked examples with real numbers, and an honest discussion of when this z-based method is appropriate and when you should reach for the t-distribution instead.
What Is a Confidence Interval?
A confidence interval is a range built around a sample estimate that would capture the true population value in a stated percentage of repeated samples. If you drew 100 different random samples and built a 95% interval from each, roughly 95 of those intervals would contain the true population mean. It is a property of the method, not of any single interval — a common misreading is "there is a 95% probability the true mean is in this specific range," which is close in spirit but not technically what the math guarantees.
Three factors control the width of the interval:
- Sample size. More data narrows the interval, but with diminishing returns — quadrupling n only halves the margin of error.
- Standard deviation. Noisier data produces wider intervals. There is no computational trick around genuinely scattered data.
- Confidence level. Wanting more certainty (99% instead of 90%) widens the interval. Confidence and precision trade off directly.
Example: a sample of 100 orders has a mean of 42.00 and a standard deviation of 15.80. The 95% margin of error is 1.96 × 15.80 / √100 = 1.96 × 1.58 = 3.10, so the interval is 38.90 to 45.10. You can say the true average order value is estimated at 42 dollars with a 95% interval spanning roughly 38.90 to 45.10.
How to Use This Calculator (Step by Step)
- Enter the sample mean — the average of your sample. If you only have raw values, compute their mean first (or paste them into a mean calculator) and enter the result.
- Enter the sample standard deviation. If your software reports the population-style standard deviation (dividing by n) rather than the sample version (dividing by n − 1), convert it: multiply by √(n / (n − 1)). For n = 25, that factor is about 1.0206.
- Enter the sample size n — the number of observations, not the population size.
- Choose the confidence level: 90%, 95%, 98%, or 99%. 95% is the standard default in most fields.
- Read the margin of error and the interval bounds. Quote the full range in your report, not just the mean.
Worked run-through: sample mean 68.4, standard deviation 9.2, n = 45, confidence 98%. The margin of error is 2.3263 × 9.2 / √45 = 2.3263 × 9.2 / 6.7082 = 3.19. The interval is 68.4 − 3.19 = 65.21 to 68.4 + 3.19 = 71.59.
The Formula and the Critical Values
The calculator uses the standard normal (z) method:
margin of error = z × s / √nlower bound = sample mean − margin of errorupper bound = sample mean + margin of error
Each confidence level corresponds to a fixed z critical value — the point where the standard normal distribution leaves the right tail area equal to (1 − confidence) / 2:
| Confidence level | z value | Tail area per side |
|---|---|---|
| 90% | 1.6449 | 5% |
| 95% | 1.9600 | 2.5% |
| 98% | 2.3263 | 1% |
| 99% | 2.5758 | 0.5% |
Seeing the multipliers side by side explains the trade-off. For a sample with s = 12 and n = 64, the standard error is 12 / 8 = 1.5, so the margins are: 1.6449 × 1.5 = 2.47 at 90%, 1.96 × 1.5 = 2.94 at 95%, 2.3263 × 1.5 = 3.49 at 98%, and 2.5758 × 1.5 = 3.86 at 99%. Moving from 90% to 99% confidence stretches the interval by over 50%.
The Honest Caveat: z vs. t
Strictly speaking, when the population standard deviation is unknown — which it almost always is in practice — the correct distribution is Student's t, not the normal. The t-distribution has heavier tails, so its critical values are larger than the z values above, especially for small samples. Using z with a small sample produces an interval that is too narrow, meaning it overstates your precision.
The practical guidance:
- n ≥ 30: the z approximation is standard practice and the difference is small. At n = 30 the exact t critical value for 95% confidence is 2.045 versus the z value 1.960 — the interval computed here is roughly 4% narrower than the fully exact one.
- n < 30: use the t-distribution. For n = 10 at 95% confidence the t critical value is 2.262 versus 1.960 — a 15% understatement of the margin of error, which is not negligible.
- Very skewed data or heavy outliers: no formula fixes a non-representative sample. Check a histogram of your raw data before trusting any interval.
This tool uses the z values transparently because they are the standard textbook method and give correct, stable results for moderate and large samples. For small samples, treat the output as a slightly optimistic approximation or use a dedicated t-based tool.
Common Use Cases
- A/B test analysis. Variant A converts at a sample mean order value of 55.20 with s = 21.00 from 400 sessions. The 95% margin of error is 1.96 × 21 / 20 = 2.06, giving 53.14 to 57.26. If variant B's interval sits entirely above this one, the difference is more than sampling noise.
- Quality control. A factory samples 36 bolts with a mean diameter of 8.24 mm and s = 0.06 mm. The 99% margin is 2.5758 × 0.06 / 6 = 0.026 mm, so the process mean is estimated at 8.24 ± 0.026 mm.
- Survey research. Respondents rate satisfaction 7.3 out of 10 with s = 1.9 from n = 250. The 95% interval is 7.3 ± 1.96 × 1.9 / 15.81 = 7.3 ± 0.24, or 7.06 to 7.54.
- Business reporting. "Weekly revenue averages 18,400 with a 95% interval of 17,600 to 19,200" is a far more defensible sentence in a deck than a bare 18,400.
- Classroom statistics. The calculator is a fast way to check hand-computed homework intervals — including spotting the classic error of dividing s by n instead of √n.
Tips and Best Practices
- Quote the interval, not just the mean. Reporting "42 ± 3.1 (95%)" in one line is clearer and more honest than two separate sentences.
- Match the confidence level to the cost of being wrong. Exploratory analysis often uses 90%; published research uses 95%; safety-critical decisions justify 99%. Do not reach for 99% just because it sounds impressive — you pay for it in width.
- Check how n was counted. Dropping three outliers from a sample of 50 means n is 47, not 50, if the exclusions happen before the mean and s are computed.
- Halving the margin of error costs 4× the data. If your interval is too wide, plan for a larger sample rather than hoping a different formula will fix it.
- Use the sample standard deviation (n − 1 version). Mixing in the population version biases the interval slightly narrow; the conversion factor √(n/(n−1)) fixes a mismatched input.
- Interpret ties to sampling, not the whole population. The interval quantifies random sampling error only; selection bias, measurement error, and non-response are separate problems no interval formula captures.
Confidence Interval vs. Margin of Error vs. Standard Error
These three terms get jumbled in reports, so here is the chain in one place. The standard error is s / √n — the typical distance between your sample mean and the true mean for samples of size n. The margin of error is the standard error multiplied by a critical value (z, or t for small samples), scaling that typical distance to your chosen confidence level. The confidence interval is the sample mean plus and minus the margin of error. With s = 20 and n = 100: standard error 2.0, 95% margin of error 3.92, interval 8.08 to 12.92 around a mean of 10.5. Keep the vocabulary straight and your methodology section will write itself.