Confidence Interval Calculator Formula

Understand the math behind the confidence interval calculator. Each variable explained with a worked example.

Formulas Used

Lower Bound

lower = x_bar - moe

Upper Bound

upper = x_bar + moe

Margin of Error

margin_of_error = moe

Standard Error

standard_error = se

Variables

VariableDescriptionDefault
x_barSample Mean50
sigmaStandard Deviation10
nSample Size36
zZ-Value (e.g., 1.96 for 95%)1.96
seDerived value= sigma / sqrt(n)calculated
moeDerived value= z * sigma / sqrt(n)calculated

How It Works

How to Calculate a Confidence Interval

Formula

CI = x_bar +/- z * (sigma / sqrt(n))

The confidence interval gives a range of plausible values for the population mean. The standard error (sigma/sqrt(n)) measures how much the sample mean varies across samples. The z-value determines the confidence level: 1.645 for 90%, 1.96 for 95%, 2.576 for 99%.

Worked Example

Sample mean = 50, SD = 10, n = 36. Build a 95% confidence interval.

x_bar = 50sigma = 10n = 36z = 1.96
  1. 01Standard Error = 10 / sqrt(36) = 10 / 6 = 1.6667
  2. 02Margin of Error = 1.96 * 1.6667 = 3.2667
  3. 03Lower bound = 50 - 3.2667 = 46.7333
  4. 04Upper bound = 50 + 3.2667 = 53.2667
  5. 0595% CI: (46.7333, 53.2667)

Frequently Asked Questions

What does 95% confidence mean?

If you repeated the sampling and CI construction many times, approximately 95% of those intervals would contain the true population mean. It does not mean there is a 95% probability the true mean is in this specific interval.

When should I use z vs. t?

Use z when the population standard deviation is known or the sample size is large (n >= 30). Use the t-distribution when the population SD is unknown and the sample is small.

How does sample size affect the interval?

Larger sample sizes produce narrower confidence intervals because the standard error decreases as sqrt(n) increases. Quadrupling the sample size halves the margin of error.

Learn More

Guide

How to Calculate Confidence Intervals

Step-by-step guide to calculating confidence intervals. Learn when to use z-intervals vs. t-intervals, how to choose a confidence level, and how to interpret the results.

Ready to run the numbers?

Open Confidence Interval Calculator