What the confidence interval calculator does
A sample mean is an estimate; a confidence interval says how precise that estimate is. Enter the sample mean, the standard deviation, the sample size and a confidence level (90%, 95% or 99%), and the calculator returns the margin of error and the interval's lower and upper bounds. It is the standard way to report survey results, experimental measurements, A/B test outcomes and quality-control checks. Runs in your browser.
The formula
Margin of error E = z × (s ÷ √n)
Interval mean ± E
z for 90% = 1.645 z for 95% = 1.960 z for 99% = 2.576
s ÷ √n is the standard error of the mean
Sample of 50 orders, mean $84.20, SD $21.50, 95%:
standard error = 21.5 ÷ √50 = 3.04
E = 1.96 × 3.04 = 5.96
interval: $78.24 to $90.16The calculator uses the z (normal) critical value, which is standard when the sample is 30 or larger. For small samples the t distribution gives a slightly wider interval — see the note below.
What 95% confidence actually means
It does not mean there is a 95% chance the true mean is in this particular interval — the true mean is fixed and is either in it or not. It means that if you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true mean. In practice it is read as: “values outside this range are implausible given the data.” A narrower interval means a more precise estimate.
What changes the width
| Factor | Effect on margin of error |
|---|---|
| Larger sample | Shrinks it — by √n, so 4× the sample halves the margin |
| More variable data (larger SD) | Widens it proportionally |
| Higher confidence level | Widens it: 99% is about 31% wider than 95% |
| Lower confidence level | Narrows it, at the cost of more intervals missing the truth |
To halve the margin of error you need four times the sample size — which is why precise surveys are expensive and why reported margins of ±3% imply samples of about 1,000.
Small samples: the t distribution
When n is below about 30 and the population SD is unknown, the correct critical value comes from the t distribution with n − 1 degrees of freedom, which is larger than z to account for the extra uncertainty in the sample SD. For n = 10 at 95%, t = 2.262 instead of 1.960 — a 15% wider interval. For n = 5, t = 2.776. If your sample is small, multiply the calculator's margin by t ÷ z, or use a statistics package.
| n | t (95%) | vs z = 1.96 |
|---|---|---|
| 5 | 2.776 | +42% |
| 10 | 2.262 | +15% |
| 20 | 2.093 | +7% |
| 30 | 2.045 | +4% |
| 100 | 1.984 | +1% |
Common uses
- Surveys and polls — reporting a result as 47% ± 3%.
- A/B tests — checking whether the intervals for two variants overlap (a rough test; a proper comparison uses a two-sample test).
- Measurement — stating the uncertainty on a lab result or a product dimension from repeated readings.
- Business metrics — average order value or session length from a sample of records.
- Quality control — whether a batch mean is within specification.