Statistics

Confidence Interval Calculator — Margin of Error

Enter your sample mean, standard deviation, and sample size to instantly calculate a 90%, 95%, or 99% confidence interval, along with the margin of error.

Advertisement

📊 Enter Sample Statistics

📊 Result

Enter sample mean, standard deviation, and sample size to see the confidence interval
⚠️

Disclaimer: This tool performs standard mathematical calculations for educational and reference purposes. Always double-check results independently for graded coursework, exams, or safety-critical applications.

What a Confidence Interval Tells You

A confidence interval gives you a range of plausible values for an unknown population mean, based on a sample you've collected. Instead of reporting a single number as your best guess, it reports a range along with a confidence level (like 95%) that describes how reliable the range-building method is. The wider the interval, the more certain you can be that it captures the true value — but the less precise that estimate becomes.

The Formula

This calculator uses the z-based confidence interval formula, appropriate when your sample size is reasonably large (a common rule of thumb is n ≥ 30) or the population standard deviation is otherwise known:

Margin of Error = z × (s / √n)

Confidence Interval = [mean − margin, mean + margin]

where s is the sample standard deviation, n is the sample size, and z is the critical value matching your chosen confidence level: 1.645 for 90%, 1.96 for 95%, and 2.576 for 99%. These values come from the standard normal distribution and represent how many standard errors you need to travel from the mean to capture the corresponding percentage of a normal curve.

Worked Example

Suppose a sample of n = 30 items has a mean of 50 and a standard deviation of 5, and you want a 95% confidence interval (z = 1.96).

  1. Step 1 — Standard error: 5 / √30 ≈ 5 / 5.477 ≈ 0.9129
  2. Step 2 — Margin of error: 1.96 × 0.9129 ≈ 1.789
  3. Step 3 — Interval: [50 − 1.789, 50 + 1.789] = [48.21, 51.79]

So we can say, with 95% confidence, the true population mean likely falls between roughly 48.21 and 51.79.

Frequently Asked Questions

It does not mean there's a 95% chance the true population mean falls in this specific interval. It means that if you repeated your sampling process many times and built a confidence interval each time, about 95% of those intervals would contain the true population mean. The 95% describes the reliability of the method, not the probability for this one interval.
Confidence and precision trade off against each other. To be more certain that your interval captures the true mean, you need to cast a wider net — that's why the z-value for 99% confidence (2.576) is larger than the z-value for 90% confidence (1.645), which pushes the margin of error, and therefore the interval width, up.
The margin of error depends on the sample standard deviation divided by the square root of the sample size. As the sample size n grows, √n grows too, which shrinks that fraction and tightens the interval. This reflects the intuitive idea that larger samples give more reliable estimates of the true population mean.
Advertisement