Descriptive statistics
Confidence Interval Calculator
The range of values your data are consistent with — usually more useful than the p-value that goes with it.
Have a spreadsheet? Drop a CSV here
Or . CSV, TSV or plain text. You pick which column is which after it loads — the names in your file do not have to match ours. The file is read in your browser and never uploaded.
How to read this result
What 95% confidence means. Repeat the study many times and build an interval each time the same way; 95% of those intervals would contain the true value. It is a property of the procedure, not of the particular interval you are looking at — which either contains the true value or does not.
It is not a 95% probability that the parameter is in this interval. The parameter is fixed; the interval is what varies. The statement people usually want — "there is a 95% chance the true value is between these numbers" — is a Bayesian credible interval, and it requires a prior.
The width is the message. A narrow interval means the study pinned the answer down; a wide one means it did not, whatever the p-value says. An interval that excludes zero and runs from 0.1 to 14.0 is technically significant and practically uninformative.
t or z? Use t whenever σ is estimated from the data, which is nearly always. The difference matters at small n — at n = 5 the multiplier is 2.78 rather than 1.96 — and disappears past about 100 observations.
For proportions, prefer Wilson. The textbook p̂ ± z·SE interval can run past 100% or below 0% and loses its coverage near the extremes. All four intervals are shown so the difference is visible.
The formula
For a mean
- the sample mean
- the sample standard deviation
- the t multiplier for the confidence level, on n − 1 df
For a proportion (Wilson)
More complicated than p̂ ± z·SE, and better behaved in every respect: it stays inside 0 and 1 and keeps its coverage at small n.
Worked example
A 95% interval for twelve exam scores
The same twelve scores: 72, 85, 78, 90, 68, 95, 88, 76, 82, 91, 79, 84. The mean is 82.33 and the standard deviation 8.083. How precisely does that pin down the class's true average?
- Compute the standard error.8.083 / √12 = 2.3333
- Find the t multiplier for 95% confidence on n − 1 = 11 degrees of freedom.t = 2.2010
- Multiply.margin of error = 2.2010 × 2.3333 = 5.1356
- Add and subtract from the mean.82.333 ± 5.136 → 77.20 to 87.47
Ten points wide from twelve students. Quadrupling the class to 48 would roughly halve that — precision improves with √n, which is why small studies produce wide intervals however carefully they are run.
Checked against R's t.test(x)$conf.int.
The calculator above is loaded with these numbers by the Load the worked example button.
Assumptions, and when to use something else
- A random sample from the population you want to describe. No amount of arithmetic fixes a biased sample; the interval will be precisely wrong.
- Independent observations.
- Roughly normal data, or a large enough sample for the central limit theorem to make the mean normal. Below about 15 observations with visible skew, an interval on the median or a bootstrap interval is safer.
- For proportions, enough successes and failures. Below about 10 of each, use the Wilson or Clopper-Pearson interval rather than the Wald one.
- You want a test rather than an intervalT-testThe same arithmetic, presented as a decision — and an interval that excludes the null value corresponds exactly to a significant test.
- You want the margin of error onlyMargin of error calculatorThe ± part, for surveys and polls.
- You are planning a studySample size calculatorWorks backwards from the interval width you want to the n you need.
- The interval is for a difference between two groupsStatistical significance calculatorIntervals for the difference between two means or two proportions.
Questions people ask
What does a 95% confidence interval actually mean?
That the method captures the true value 95% of the time in repeated sampling. Your particular interval either contains the true value or it does not — there is no probability attached to it once it is computed. The figure above shows twenty intervals from twenty samples, nineteen of which cover the truth.
Why is my interval so wide?
Because n is small, the data are spread out, or you asked for a high confidence level — those are the only three inputs. Width is proportional to s/√n, so quadrupling the sample halves it.
Should I use 90%, 95% or 99%?
95% is the convention and needs no defence. 99% is wider and used where a false positive is costly; 90% is narrower and common in exploratory work. Choose before seeing the data — picking the level that makes the interval exclude zero is exactly the manoeuvre the level exists to prevent.
Can a confidence interval replace a p-value?
For most purposes, yes — and it is usually the better choice. A 95% interval that excludes the null value corresponds to p < 0.05, and it additionally tells you how large the effect plausibly is, which the p-value cannot.