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 - moeUpper Bound
upper = x_bar + moeMargin of Error
margin_of_error = moeStandard Error
standard_error = seVariables
| Variable | Description | Default |
|---|---|---|
x_bar | Sample Mean | 50 |
sigma | Standard Deviation | 10 |
n | Sample Size | 36 |
z | Z-Value (e.g., 1.96 for 95%) | 1.96 |
se | Derived value= sigma / sqrt(n) | calculated |
moe | Derived 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.
- 01Standard Error = 10 / sqrt(36) = 10 / 6 = 1.6667
- 02Margin of Error = 1.96 * 1.6667 = 3.2667
- 03Lower bound = 50 - 3.2667 = 46.7333
- 04Upper bound = 50 + 3.2667 = 53.2667
- 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