Confidence Interval Calculator
Compute the confidence interval and margin of error for a sample mean using the Z-distribution — 90 %, 95 %, and 99 % confidence levels.
Inputs
Results
What is a confidence interval?
A confidence interval is a range of plausible values for an unknown population parameter — typically the mean — computed from sample data together with a stated confidence level. It pairs a point estimate (the sample mean) with a margin of error that reflects how much the estimate could vary from one sample to the next.
Formulas
With sample mean , standard deviation , sample size , and critical Z-value :
Standard error:
SE=nσMargin of error:
ME=z∗×SE=z∗×nσConfidence interval:
CI=xˉ±ME=[xˉ−z∗nσ, xˉ+z∗nσ]Critical Z-values (standard normal distribution):
| Confidence Level | |
|---|---|
| 90% | 1.6449 |
| 95% | 1.9600 |
| 99% | 2.5758 |
Interpretation
A confidence interval does not state the probability that the true mean falls inside a particular interval. The true population mean is a fixed (unknown) constant — it is not random. The interval is the random object, because it is built from a random sample.
The precise meaning is a statement about the procedure: if the sampling process were repeated many times and a 95% confidence interval were built from each sample, approximately 95% of those intervals would contain the true mean. Any single interval either contains or it does not.
In practice, a 95% confidence interval is a range that covers the true value for 95% of samples drawn the same way; on average 1 interval in 20 misses.
When to use Z vs. t
This calculator uses the Z-distribution (standard normal). This is appropriate when:
- The population standard deviation is known, OR
- The sample size is large (), so the Central Limit Theorem guarantees the sampling distribution is approximately normal
When is unknown and $n < 30$, use the t-distribution with $n - 1$ degrees of freedom. The t-distribution has heavier tails, producing wider (more conservative) intervals. For , the difference between Z and t is negligible.
How sample size affects the interval
The margin of error shrinks as grows. Halving the margin of error requires four times the sample size — a key constraint in survey design.
| Sample size | ME (95%, σ = 10) |
|---|---|
| n = 25 | ±3.92 |
| n = 100 | ±1.96 |
| n = 400 | ±0.98 |
| n = 1600 | ±0.49 |
Worked example: exam score analysis
A teacher randomly selects 35 exam papers from a class. The sample mean score is 47.3 points with a standard deviation of 11.8.
Standard error:
95% confidence interval:
CI=[47.3−3.91, 47.3+3.91]=[43.4, 51.2]Interpretation: "Based on this sample of 35, we estimate the class average lies between 43.4 and 51.2, with 95% confidence."
What changes with 99% confidence? The interval widens: , giving $[42.2, 52.4]$. More confidence costs width.
Frequently Asked Questions (FAQ)
What does a 95% confidence interval mean?
A 95% confidence interval does not mean "there is a 95% chance the true mean is in this range." The true mean is fixed — it either is or is not in any given interval. The correct interpretation is a statement about the procedure: if the sampling procedure were repeated many times and a confidence interval built each time, 95% of those intervals would contain the true population mean. The computed interval is one such interval.
How do you calculate the margin of error?
Margin of error = z* × (σ / √n), where z* is the critical Z-value for your confidence level (1.6449 for 90%, 1.9600 for 95%, 2.5758 for 99%), σ is the standard deviation, and n is the sample size. For a 95% CI with σ = 11.8 and n = 35: SE = 11.8 / √35 ≈ 1.994, ME = 1.96 × 1.994 ≈ 3.91.
What is the difference between a confidence interval and a prediction interval?
A confidence interval estimates where the population mean lies. A prediction interval estimates where a single new observation will fall. Prediction intervals are always wider because they account for both the uncertainty in the mean and the variability of individual observations. For a normal distribution, a 95% prediction interval is roughly x̄ ± 2σ.
When should I use a t-distribution instead of Z?
Use a t-distribution (t-score instead of Z-score) when: (1) the population standard deviation σ is unknown and you are estimating it from the sample, or (2) the sample size is small (n < 30) and the population is not known to be normal. For large samples (n ≥ 30), the t-distribution approximates the normal distribution so Z is a good approximation. This calculator uses the Z-distribution, which is appropriate when σ is known or n ≥ 30.
Recommended Next
Descriptive Statistics Calculator
Calculate mean, standard deviation, variance, range, min, and max for 8 data values. Shows both population and sample statistics.