Confidence Interval Calculator - Mean & Proportion
Calculate confidence intervals for a population mean from sample statistics or raw data
Enter your sample mean, standard deviation, and sample size — or provide raw data — to compute confidence intervals at 90%, 95%, or 99% confidence levels.
Confidence Interval Calculator - Mean & Proportion
Calculate confidence intervals for a population mean from sample statistics or raw data
About Confidence Interval Calculator
A confidence interval (CI) is a range of values that is likely to contain the true population parameter — most commonly the population mean — with a specified level of confidence. Confidence intervals are among the most widely used tools in inferential statistics, enabling researchers to quantify the uncertainty in their estimates and communicate precision clearly.
The formula for a confidence interval for a population mean (when the population standard deviation is unknown and the sample size is reasonably large) is: CI = x̄ ± z* × (s / √n), where x̄ is the sample mean, s is the sample standard deviation, n is the sample size, and z* is the critical value from the standard normal distribution corresponding to the chosen confidence level. For a 95% CI, z* = 1.96; for 90%, z* ≈ 1.645; for 99%, z* ≈ 2.576.
The term s / √n is called the standard error of the mean (SE). It measures how much the sample mean is expected to vary from sample to sample. A larger sample size reduces the SE, producing a narrower, more precise interval. The margin of error (MOE) is z* × SE; the CI lower bound is x̄ − MOE and the upper bound is x̄ + MOE.
Interpreting a confidence interval correctly is important. A 95% confidence interval does NOT mean there is a 95% probability that the true mean lies within this particular interval. Rather, it means that if you were to repeat the sampling procedure many times and compute a CI each time, approximately 95% of those intervals would contain the true mean. The confidence is in the procedure, not in any single interval.
Confidence intervals are used in clinical trials to report treatment effects, in polls to report margins of error, in quality control to monitor process means, and in any scientific study where estimation from a sample is required. This calculator uses the z-distribution (normal approximation), which is accurate for large samples (n ≥ 30) or when the population distribution is approximately normal. For small samples from unknown distributions, a t-distribution-based interval would be more appropriate.
Examples
The table below shows confidence interval calculations for typical statistical scenarios.
| Inputs | 95% CI | Context |
|---|---|---|
| x̄=75, s=5, n=100, 95% CI | (74.02, 75.98) | Student test scores — large sample |
| x̄=250, s=10, n=50, 99% CI | (246.36, 253.64) | Product weight in grams — high confidence |
| data: 22,25,21,24,23,26,20, 90% CI | (21.66, 24.34) | Daily temperatures — small raw dataset |
| x̄=35, s=8, n=200, 95% CI | (33.89, 36.11) | Average delivery time in minutes |
How to Use the Confidence Interval Calculator
- Choose 'Summary Statistics' if you already have the sample mean, standard deviation, and sample size; or choose 'Raw Data' to enter individual data values.
- Select the confidence level: 90% (z=1.645), 95% (z=1.96), or 99% (z=2.576). Higher confidence requires a wider interval.
- For summary statistics, enter the sample mean (x̄), sample standard deviation (s ≥ 0), and sample size (n ≥ 2). For raw data, enter numbers separated by commas or spaces.
- Click 'Calculate' to see the confidence interval bounds, margin of error, and standard error.
- Interpret the result: the interval (lower, upper) is a range that captures the true population mean with the chosen confidence level under repeated sampling.
Frequently Asked Questions
What does a 95% confidence interval mean?
A 95% CI means that if you repeated the same sampling procedure many times and computed a confidence interval each time, approximately 95% of those intervals would contain the true population mean. It does not mean there is a 95% chance the true mean is in this specific interval — once computed, the interval either contains the true mean or it does not.
What is the margin of error?
The margin of error (MOE) is half the width of the confidence interval: MOE = z* × (s / √n). It quantifies the maximum expected difference between the sample mean and the true population mean at the chosen confidence level. Reducing MOE requires a larger sample size, a smaller standard deviation (less variability in the data), or accepting a lower confidence level.
Should I use a z-distribution or a t-distribution?
Use the z-distribution (as this calculator does) when the sample size is large (n ≥ 30) or when the population standard deviation is known. Use the t-distribution when n < 30 and the population standard deviation is unknown, because the t-distribution has heavier tails and accounts for the extra uncertainty in estimating the standard deviation from a small sample.
How does sample size affect the confidence interval?
Increasing the sample size n decreases the standard error (s / √n) and therefore narrows the confidence interval. For example, doubling the sample size reduces the margin of error by a factor of √2 ≈ 1.41. This is why surveys with large sample sizes (e.g., n=1000) have small margins of error (~3% at 95%), while pilot studies with n=20 may have very wide intervals.
What if my data is not normally distributed?
The Central Limit Theorem guarantees that the distribution of sample means approaches normality as n increases, regardless of the population distribution. For n ≥ 30, the z-based confidence interval is generally reliable. For smaller samples with strongly skewed or heavy-tailed distributions, consider bootstrap confidence intervals or a t-based interval, both of which are more robust.
Can I compute a confidence interval for a proportion?
Yes, but the formula differs. For a sample proportion p̂ from n trials, the Wald CI is p̂ ± z* × √(p̂(1−p̂)/n). This calculator is designed for the mean. For proportions — such as estimating the fraction of voters who support a candidate — use a dedicated proportion confidence interval tool. The Wilson score interval is generally preferred over the Wald formula for small samples or proportions near 0 or 1.