Skip to content

Confidence Interval Calculator for a Mean

Calculate a 90%, 95% or 99% confidence interval for a mean from the sample mean, standard deviation and sample size, with the margin of error explained step by step.

4 min read

A sample can only estimate the true average of a population, and every estimate comes with uncertainty. A confidence interval puts a range around the sample mean that is likely to contain the true mean. Our confidence interval calculator gives the interval and margin of error from three summary numbers. This guide explains the formula, how to read the result and what affects the width.

How to use the calculator

  1. Sample mean: the average of your sample.
  2. Standard deviation: how spread out the sample values are.
  3. Sample size: how many observations you have.
  4. Confidence level: 90%, 95% or 99%.

With the defaults, a mean of 100, SD of 15, sample size of 50 and 95% confidence:

  • 95% interval: 95.84 to 104.16
  • Margin of error: ±4.16
  • Critical value z*: 1.96

The formula

  • x̄ is the sample mean.
  • s ÷ √n is the standard error: how much the sample mean would vary from sample to sample.
  • z* is the critical value for the confidence level.

Step by step for the default:

  1. Standard error: 15 ÷ √50 = 15 ÷ 7.071 = 2.121.
  2. Margin of error: 1.96 × 2.121 = 4.158.
  3. Interval: 100 − 4.158 to 100 + 4.158 = 95.84 to 104.16.

Critical values

Confidencez*
90%1.645
95%1.960
99%2.576

These come from the normal distribution: 95% of values lie within 1.96 standard deviations of the mean. The z-score calculator shows the link.

What the interval means

A 95% confidence interval means that if you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true population mean.

It does not mean there is a 95% chance the true mean lies in this particular interval: the true mean is fixed, and the interval either contains it or not. In everyday terms, though, it is a range of plausible values for the true mean.

What makes the interval wider or narrower

ChangeEffect on width
Higher confidence (99% vs 95%)Wider
Larger standard deviationWider
Larger sample sizeNarrower

Because the standard error divides by √n, you need four times the sample size to halve the margin of error. With n = 200 instead of 50, the default margin drops from ±4.16 to about ±2.08.

Comparing confidence levels for the default data:

  • 90%: 100 ± 3.49 → 96.51 to 103.49
  • 95%: 100 ± 4.16 → 95.84 to 104.16
  • 99%: 100 ± 5.46 → 94.54 to 105.46

Worked example

A coffee shop times 40 customers' waits. The mean is 4.2 minutes and the SD is 1.5 minutes. At 95%: standard error = 1.5 ÷ √40 = 0.237; margin = 1.96 × 0.237 = 0.465. The interval is 3.74 to 4.67 minutes. The shop can be fairly confident the true average wait is under 5 minutes.

Small samples and the t-distribution

This calculator uses z critical values, which are accurate for samples of about 30 or more. For small samples with an unknown population SD, statisticians use the t-distribution, which has slightly larger critical values. For n = 10 at 95%, t* is 2.262 rather than 1.96. If your sample is small, treat the interval as slightly too narrow.

Before you calculate

Reporting your result

When you write up a confidence interval, give the estimate, the interval and the level together, for example: the mean wait was 4.2 minutes (95% CI 3.74 to 4.67). Mention the sample size so readers can judge how much weight to put on it. If two groups have intervals that do not overlap, their means are very likely different, although overlapping intervals do not prove the means are the same. A formal test, with a p-value, answers that question more precisely.

Frequently asked questions

Which confidence level should I use?

95% is the most common choice. Use 99% when being wrong is costly, and 90% when a narrower, less certain range is acceptable.

What is the margin of error?

Half the width of the interval: the amount added to and subtracted from the sample mean. Polls often report it as plus or minus a percentage.

How can I make my interval narrower?

Collect a larger sample, reduce measurement variability, or accept a lower confidence level.

Does this work for proportions?

This calculator is for means. For survey percentages, the sample size calculator uses the proportion formula instead.

Share

Try it yourself

Run your own numbers with our free tool: Confidence interval calculator. No sign-up, and it works on any device.

Open the calculator