What This Confidence Interval Calculator Does
A confidence interval gives you a range of values that likely contains the true population mean, based on a single sample. This calculator takes your sample statistics and returns a lower bound, an upper bound, and the margin of error — so you can report results like "the true average is between X and Y, with 95% confidence." It uses the z-distribution (normal distribution), which is the standard approach when the sample is reasonably large or the population standard deviation is known.
The Inputs You Provide
- Sample Mean — the average of your sample data (the centre of your interval).
- Standard Deviation — how spread out your sample values are.
- Sample Size — the number of observations in your sample.
- Confidence Level — how sure you want to be, typically 90%, 95%, or 99%.
The Formula
The calculator works through these steps:
- Standard Error = Standard Deviation ÷ √(Sample Size)
- Z-score = the critical value from the normal distribution for your confidence level (e.g. 1.645 for 90%, 1.96 for 95%, 2.576 for 99%)
- Margin of Error = Z-score × Standard Error
- Confidence Interval = Sample Mean ± Margin of Error
It finds the z-score by taking the inverse cumulative probability at alpha/2, where alpha = 1 − confidence level. This splits the uncertainty evenly between the two tails.
Worked Example
Suppose your sample mean is 100, standard deviation is 15, sample size is 36, and you choose a 95% confidence level.
- Standard Error = 15 ÷ √36 = 15 ÷ 6 = 2.5
- Z-score for 95% = 1.96
- Margin of Error = 1.96 × 2.5 = 4.9
- Lower bound = 100 − 4.9 = 95.1
- Upper bound = 100 + 4.9 = 104.9
You can be 95% confident the true population mean falls between 95.1 and 104.9.
Interpreting Your Confidence Interval
A confidence interval reports a range of plausible values for the population mean \(\mu\), built from your sample. The statement it supports is about the procedure, not about the one interval on your screen: if you repeated the same sampling and computed a 95% interval each time, about 95% of those intervals would contain the true mean. The true mean is a fixed (but unknown) number — it does not move. What is random is the interval, because it is computed from a random sample. So it is not correct to say "there is a 95% probability that \(\mu\) lies between these two numbers"; once the interval is computed, \(\mu\) either is inside it or is not. (Bayesian credible intervals do support a direct probability statement, but they are a different construction and require a prior.)
Width: what makes an estimate precise
A narrower interval means a more precise estimate. The half-width is the margin of error
$$\text{MoE} = z \cdot \frac{s}{\sqrt{n}}$$so three things move it:
- Sample size \(n\) — the margin shrinks with \(\sqrt{n}\), not with \(n\). Quadrupling the sample halves the margin of error; halving the margin again requires 16× the original sample. This is why precision gets expensive fast.
- Confidence level — a higher level uses a larger critical value, so a 99% interval is always wider than a 95% interval on the same data (\(2.576/1.960 \approx 1.31\), about 31% wider). Confidence and precision trade off against each other.
- Spread \(s\) — more variable data gives a wider interval for the same \(n\).
Reading a reference or hypothesised value
Check whether a value you care about — 0 for a difference or change score, a target mean, last year's figure, a spec value — falls inside the interval. If the reference value lies outside a two-sided \(100(1-\alpha)\%\) interval, the corresponding two-sided test of \(H_0: \mu = \text{reference}\) rejects at significance level \(\alpha = 1 - \text{confidence level}\); if it lies inside, the test does not reject. A 95% interval and a two-sided test at \(\alpha = 0.05\) are two views of the same calculation. "Not rejected" means the data are compatible with that value — not that the value is true, and not that the effect is zero.
Also read the interval's endpoints substantively. An interval of [0.2, 19.8] excludes zero but is compatible with effects ranging from trivial to large; that is a different situation from [9.5, 10.5], which excludes zero and pins the effect down.
Means, not individuals
This interval covers the average of the population, not the next observation. With a large \(n\) the interval for the mean can be very narrow while individual values still scatter widely. If you need a range that is likely to contain a single future observation, that is a prediction interval, which is much wider because it must absorb individual variation in addition to uncertainty about the mean.
Assumptions you are relying on
- Random, independent observations from the population of interest. Convenience samples, clustered data, repeated measures on the same subjects and time-series data violate this, and the interval will typically be too narrow.
- Approximate normality of the sampling distribution of the mean. By the Central Limit Theorem this is usually reasonable once \(n \ge 30\) for moderately skewed data; for small samples the population itself should be roughly normal, and for strongly skewed data or heavy outliers even \(n = 30\) may not be enough.
- Known-\(\sigma\) or large-\(n\) approximation. This calculator uses the normal critical value \(z\). When \(\sigma\) is estimated by \(s\) from a small sample, the \(t\) distribution with \(n-1\) degrees of freedom is the strictly correct choice and gives a slightly wider interval; the difference is small once \(n\) is above roughly 30.
- No systematic error. The interval quantifies sampling variability only. It does not correct for selection bias, non-response, a badly worded question, a miscalibrated instrument or measurement error. A biased sample produces a tight interval around the wrong value — and a large \(n\) makes that wrong interval tighter, not better.
Finally, if you compute many intervals from the same data, the chance that at least one misses its target rises well above \(\alpha\); that requires a multiplicity adjustment. This section is general statistical information, not tailored advice for a specific study design.
Key Terms and Variables
| Term | Symbol | Meaning |
|---|---|---|
| Sample mean | \(\bar{x}\) | The arithmetic average of your observed data, \(\bar{x} = \frac{1}{n}\sum x_i\). It is what you measure and the centre of the interval. |
| Population mean | \(\mu\) | The true average across the whole population. Unknown, fixed, and the quantity the interval is trying to bracket. |
| Sample standard deviation | \(s\) | Spread of the individual observations, computed with \(n-1\) in the denominator: \(s = \sqrt{\frac{\sum (x_i - \bar{x})^2}{n-1}}\). |
| Population standard deviation | \(\sigma\) | True spread in the population. Rarely known; \(s\) is used as its estimate, which is why the \(t\) distribution exists. |
| Sample size | \(n\) | Number of independent observations. Drives precision through \(\sqrt{n}\). |
| Standard error of the mean | SE | \(\text{SE} = s/\sqrt{n}\). The typical distance between a sample mean and the population mean. Distinct from \(s\): \(s\) describes how spread out individuals are and does not shrink as you collect more data; SE describes how uncertain the mean is and shrinks as \(n\) grows. |
| Margin of error | MoE | \(\text{MoE} = z \times \text{SE}\). The half-width of the interval — the "± number" reported alongside the estimate. |
| Confidence level | \(1-\alpha\) | The long-run proportion of intervals built this way that would capture \(\mu\) (e.g. 95%). The same value written as a decimal (0.95) is the confidence coefficient. |
| Alpha | \(\alpha\) | \(\alpha = 1 - \text{confidence level}\); the long-run miss rate, and the significance level of the equivalent two-sided test. |
| Alpha over two | \(\alpha/2\) | The tail area at each end of a two-sided interval — 0.025 per tail for a 95% interval. |
| Critical value / z-score | \(z\) | The multiplier \(\Phi^{-1}(1-\alpha/2)\) from the standard normal distribution. A z-score more generally states how many standard deviations a value sits from the mean. |
| Lower bound | LB | \(\bar{x} - \text{MoE}\), the smaller endpoint of the interval. |
| Upper bound | UB | \(\bar{x} + \text{MoE}\), the larger endpoint. The interval is written \([\text{LB},\ \text{UB}]\). |
| Degrees of freedom | \(df = n-1\) | The number of independent pieces of information left after estimating \(\bar{x}\). Selects the row of the \(t\) table when using the \(t\) alternative to \(z\). |
| Point estimate | \(\bar{x}\) | A single best-guess number for \(\mu\). It carries no indication of its own uncertainty. |
| Interval estimate | \([\text{LB}, \text{UB}]\) | A range with a stated confidence level. Reports the point estimate and its precision, which is why journals and standards bodies generally prefer it. |
| Confidence interval | CI | A range for a parameter — here the population mean. Narrows toward a single point as \(n \to \infty\). |
| Prediction interval | PI | A range for a single future observation. Always wider than the CI on the same data, because it includes individual-level variation; it does not shrink to a point as \(n\) grows, converging instead to roughly \(\mu \pm z\sigma\). |
Frequently Asked Questions
Does a wider interval mean a worse result? A wider interval reflects more uncertainty. Raising the confidence level (e.g. from 95% to 99%) or having a smaller sample widens the interval; a larger sample narrows it.
What does "95% confidence" actually mean? If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true population mean.
Should I use z or t? This tool uses the z (normal) distribution, which is appropriate for larger samples or when the population standard deviation is known. For very small samples with an unknown population standard deviation, a t-distribution is technically more precise.