A confidence interval gives a range of plausible values for a population parameter, with a stated confidence level — usually 95%. A 95% CI means that if you repeated the study many times, about 95% of the intervals built this way would contain the true value. It is not a 95% probability that the true value lies in this one particular interval. Wider intervals signal more uncertainty; larger samples make them narrower. Results here are validated against SciPy to full precision.

When to use a confidence interval

Use a confidence interval whenever you estimate a population quantity — a mean, a proportion, a difference — from a sample and want to communicate the uncertainty around that estimate. CIs are often more informative than a bare p-value because they show both the size of an effect and its precision.

How to read it correctly

The confidence level describes the procedure, not a single interval. “95% confident” means the method captures the true parameter 95% of the time over many repetitions. Once you compute a specific interval, the true value is either in it or not — there is no probability attached to that one interval. For the intuition behind this, try the interactive confidence-interval simulator.

Assumptions

Common mistakes

Worked example

A sample of 40 with mean 100 and SD 15 gives a 95% CI for the mean of roughly 100 ± 4.8, i.e. about [95.2, 104.8]. Quadrupling the sample size halves the margin of error. Enter your data above to compute the interval; see the confidence intervals guide for more.

Guide: Confidence Intervals

A confidence interval (CI) is a range of plausible values for an unknown population parameter (such as the true mean or proportion), based on your sample data.

A 95% CI means: if you repeated your study 100 times, approximately 95 of those intervals would contain the true population parameter. It does not mean there is a 95% probability that the true value is in this specific interval.

CI for a mean: Use when your outcome is a continuous measurement (height, weight, test score, reaction time). Uses the t-distribution and requires raw data.

CI for a proportion: Use when your outcome is a count of successes out of n trials — a proportion or rate (e.g. "45 out of 100 patients recovered"). Enter the number of successes (x) and total sample size (n).

A narrower CI is more informative. The width depends on:

  • Sample size (n): Larger n → narrower CI. The CI width shrinks proportional to 1/√n.
  • Variability: Higher SD → wider CI.
  • Confidence level: 99% CI is wider than 95% CI, which is wider than 90% CI. More confidence requires a wider net.

Both carry similar information. The p-value tells you whether the effect is significant; the CI tells you both significance and the likely magnitude of the effect. Many journals now require CI reporting because it is more informative.

A key link: if a 95% CI for the difference between two means does not include 0, the corresponding two-sided p-value will be < 0.05.