A confidence interval expresses the uncertainty around an estimate from a sample. Calculate the interval for a mean or a proportion, see the margin of error, and find the sample size needed to reach a target precision.
How it works
Calculate a confidence interval for a population mean (t or z) or a proportion (Wald and Wilson), with the margin of error and the sample size needed for a target precision.
Mean (σ unknown): x̄ ± t(α/2, n−1) × s ÷ √n
Mean (σ known): x̄ ± z(α/2) × σ ÷ √n
Proportion (Wald): p̂ ± z × √(p̂(1 − p̂) ÷ n)
Finite population correction = √((N − n) ÷ (N − 1))
Required n (mean) = (z·σ ÷ E)²; (proportion) = z²·p(1 − p) ÷ E²
Common uses
- Survey and patient-satisfaction results
- Audit and quality-control sampling
- Statistics coursework and research
Worked example
The calculator above opens with this example. Change any input to see the results update instantly, or select Reset to return to these figures.
| Estimate | Mean, population SD unknown (t) |
| Sample mean | 52.4 |
| Standard deviation | 8.6 |
| Sample size (n) | 40 |
| Confidence level | 95% |
| 95.0% confidence interval | 49.65 to 55.15 |
| Sample mean | 52.40 |
| Margin of error | 2.75 |
| Standard error | 1.3598 |
| Critical value (t) | 2.0227 |
If you repeated the sampling many times, about 95.0% of intervals built this way would contain the true value.
Interpreting the results
- Use the t interval for means unless the population standard deviation is genuinely known.
- For proportions near 0% or 100%, or small samples, rely on the Wilson interval shown in the notes.
- Halving the margin of error requires roughly four times the sample size.
Frequently asked questions
What does a 95% confidence interval mean?
If the same sampling process were repeated many times, about 95% of the intervals built this way would contain the true population value. It does not mean there is a 95% probability that this particular interval contains it.
When should I use t instead of z?
Use the t distribution when the population standard deviation is unknown and estimated from the sample, which is almost always the case in practice. The z distribution applies when the population standard deviation is known.
How can I reduce the margin of error?
Increase the sample size or accept a lower confidence level. Because the margin of error falls with the square root of the sample size, halving it requires about four times as many observations.
Related calculators
- Descriptive Statistics Calculator: Mean, median, standard deviation, quartiles, skewness and kurtosis.
- Linear Regression & Trend Forecast: Slope, intercept, R², p-values and forecasts with confidence and prediction intervals.
- Correlation Matrix Calculator: Pearson or Spearman correlation matrix with p-values for every pair.
- Sample Size Calculator: Required sample size for surveys, means and A/B tests with power.
- Hypothesis Test Calculator (t, z, Chi-Square): One- and two-sample t-tests, proportion z-tests and chi-square tests of independence.