Confidence interval calculator
This confidence interval calculator helps you determine the confidence interval based on four inputs: sample size, sample mean, standard deviation, and confidence level. The calculations assume that the sample mean follows a normal distribution.
Results:
Margin of error: -
Ratio (Margin / mean): -
Confidence interval (Mean ± margin): -
Confidence interval: [-, -]
Related calculators:
What is a confidence interval?
A confidence interval (CI) is a range of values used to estimate an unknown population parameter, such as the population mean (μ). It gives a range of plausible values where we expect the true value to fall with a certain level of confidence.
Formula for confidence interval
The confidence interval for a population mean when the standard deviation is known is:
CI = \bar{x} \pm Z \times \left(\frac{\sigma}{\sqrt{n}}\right)
where:
- \bar{x} = Sample mean
- Z = Critical value (Z-score) based on the confidence level
- \sigma = Standard deviation
- n = Sample size
Example calculation
Let’s say we have:
- Sample size (n ) = 40
- Sample mean (\bar{x}) = 15
- Standard deviation (\sigma ) = 9
- Confidence level = 99.9% (which gives Z = 3.291)
Compute standard error (SE)
SE = \frac{\sigma}{\sqrt{n}} = \frac{9}{\sqrt{40}} = 1.423
Calculate margin of error (MOE)
MOE = Z \times SE = 3.291 \times 1.423 = 4.683
Compute confidence interval
CI = 15 \pm 4.683 \\ CI = [10.317, 19.683]
Interpreting the confidence interval
A 99.9% confidence interval of [10.317, 19.683] means:
- We are 99.9% confident that the true population mean falls within this range.
- It does not mean that there’s a 99.9% probability the mean is inside this range. Instead, it means that if we repeatedly take samples and compute intervals, 99.9% of them would contain the true mean.
Key takeaways
✅ Higher confidence levels (e.g., 99%) result in wider intervals, increasing certainty but reducing precision.
✅ Larger sample sizes reduce the interval width, improving accuracy.
✅ Confidence intervals do not predict individual values, only population parameters.
Z-values for several commonly used confidence levels
Here are the Z-values (critical values) for several commonly used confidence levels:
Confidence level (%) | Z-Value (Standard normal) | |||
---|---|---|---|---|
80% | 1.282 | |||
85% | 1.44 | |||
90% | 1.645 | |||
95% | 1.96 | |||
98% | 2.326 | |||
99% | 2.576 | |||
99.50% | 2.807 | |||
99.90% | 3.291 |
How these Z-values are found
The Z-value represents the number of standard deviations away from the mean that captures the central (Confidence level)% of a standard normal distribution.
To get the Z-score:
- Find \alpha:
\alpha = 1 - \frac{\text{Confidence level}}{100}
- Look up Z_{\alpha/2} in a standard normal table (or use the inverse normal function).
Example
For 95% confidence:
- \alpha = 1 - 0.95 = 0.05
- Since the confidence interval is two-tailed, we take \alpha/2 = 0.025 in each tail.
- From the Z-table, the Z-score for 0.975 cumulative probability is 1.960.