Confidence Interval Calculator
Enter your sample mean, standard deviation and sample size, choose a confidence level, and the calculator returns the confidence interval for the population mean along with the margin of error and standard error.
95% confidence interval for the mean
(67.02, 68.98)
- Lower bound
- 67.02
- Upper bound
- 68.98
- Margin of error (±)
- 0.98
- Standard error (σ/√n)
- 0.5
- z critical value
- 1.9600
We are 95% confident that the true population mean lies within (67.02, 68.98). The interval is the sample mean 68 ± 0.98, where the margin combines the z critical value (1.9600) and the standard error of the mean (0.5).
How to use this calculator
Pick your confidence level (95% is the conventional default in most fields; 90% is common in business analytics, 99% in clinical or safety-critical work). Enter the sample mean (x̄) — the average of the values you measured. Enter the standard deviation (σ) — use the population SD if you know it, otherwise use the sample SD as an estimate (the result is exact when σ is known, and a good approximation when n is reasonably large). Enter the sample size (n) — the number of observations in your sample, not the population. The calculator returns the lower and upper bounds of the interval, the margin of error, the standard error of the mean, and the z critical value it used.
How the calculation works
The confidence interval for a population mean is x̄ ± z* · (σ / √n). The standard error σ/√n measures how much the sample mean would vary from sample to sample; the z critical value z* widens that variability by the factor needed to capture the chosen percentage of all possible sample means. The two-sided z critical values come from the standard normal distribution: 1.6449 for 90%, 1.96 for 95%, 2.5758 for 99%. The interval is symmetric around x̄ — the margin of error is added to and subtracted from the sample mean. As the sample size n grows, the standard error shrinks like 1/√n, so quadrupling n halves the margin of error.
Worked example
A nutritionist samples 36 patients and finds a mean daily calcium intake of 68 mg, with a known population standard deviation of 3 mg. A 90% confidence interval uses z* = 1.6449. The standard error is 3 / √36 = 0.5. The margin of error is 1.6449 × 0.5 = 0.8224. So the 90% confidence interval for the population mean is 68 ± 0.8224, or (67.18, 68.82). At 95% confidence (z* = 1.96) the margin widens to 0.98, giving (67.02, 68.98) — a slightly wider but more confident statement.
Frequently asked questions
What does a 95% confidence interval actually mean?
It means that if you repeated the same sampling procedure many times and built the same kind of interval each time, about 95% of those intervals would contain the true population mean. It is not a 95% probability that this particular interval contains the true mean — once the sample is taken, the interval is fixed and the true mean is either in it or it is not. The 95% refers to the long-run reliability of the procedure, not to a probability statement about one specific interval.
Should I use the z-interval or the t-interval?
Use the z-interval (this calculator) when the population standard deviation σ is known, or when the sample size is large (commonly n ≥ 30) so the sample SD reliably estimates σ. Use the t-interval when σ is unknown and n is small (n < 30) — the t-distribution has heavier tails, so it gives a slightly wider, more conservative interval. For very large samples, the z- and t-intervals coincide to four decimal places, so the practical difference is negligible above about n = 100.
How do I shrink the margin of error?
Three levers, in roughly increasing order of cost. First, accept a lower confidence level — going from 99% to 95% shrinks the margin by about 24%. Second, reduce variability in your data — better measurement protocols and stratified sampling cut σ. Third, increase the sample size — but because standard error falls as 1/√n, you must quadruple n to halve the margin of error. Trying to combine all three is more efficient than relying on any one alone.
What if my sample is not random?
The formula assumes simple random sampling from the target population. With clustered, stratified or convenience samples the standard error in this calculator under-estimates the true uncertainty and the interval will be too narrow. Survey researchers correct for this with a design effect (deff) — a multiplier on the variance — and methodologists generally treat any deff above about 2 as a warning that the simple z-interval is misleading. If your sample design is complex, use software that supports it (R’s survey package, Stata svy commands).
Can I use this for proportions or differences instead of a mean?
No — this calculator is for the mean of a continuous variable. For a single proportion, use the formula p̂ ± z · √(p̂(1−p̂)/n), which our sample-size calculator inverts. For a difference between two means or two proportions, the standard error is built from both samples and the formula differs. The conceptual structure (point estimate ± z · SE) is the same, but the SE calculation is not.
Why are the z-values not whole numbers like 1.96?
They are derived from the inverse cumulative distribution function of the standard normal, evaluated at 1 − α/2. The true 95% two-sided critical value is 1.959964…, which textbooks round to 1.96. The other tabled values follow the same convention: 1.6449 (90%), 2.5758 (99%), 3.2905 (99.9%). This calculator uses the unrounded values internally, then displays four decimal places — so your result matches statistical software (R, Python’s scipy.stats.norm.ppf) to four decimals.