Skip to content

Confidence Interval Calculator

Turn a mean, a standard deviation and a sample size into a margin of error and an interval, with the Student t value the sample size actually calls for.

Critical value t at 24 degrees of freedom

2.064

Standard error of the mean

3

Margin of error

6.192

Lower limit

93.808

Upper limit

106.192

x̄ ± t(1 − α/2, n − 1) × s / √n

A confidence interval puts a width on an average. You measured 25 things, got a mean of 100, and the next 25 things would have given you something else — the interval says how far off that something else is likely to be. The width comes from three numbers: how scattered your data is, how many observations you have, and how confident you want to be. This page takes those three and gives you the margin of error and the two limits, using the Student t value for your sample size rather than the flat 1.96 that only holds for large samples.

How it is calculated

x̄ ± t(1 − α/2, n − 1) × s / √n

The standard error s/√n says how much the sample mean itself would wobble between samples, and the critical value says how many standard errors wide to draw the interval for the confidence you asked for. The t value depends on the sample size because the standard deviation was estimated from the same small sample: with 9 degrees of freedom the 95 % multiplier is 2.262, not 1.960, and using the larger-sample number would draw an interval about 13 % too narrow. That is the whole reason Student's t exists.

Source: NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2, Confidence Limits for the Mean — Ȳ ± t(1−α/2, N−1) · s/√N, where Ȳ is the sample mean, s the sample standard deviation and N the sample size; the same section warns that a 95 % confidence interval does not mean that there is a 95 % probability that the interval contains the true mean, since the interval computed from a given sample either contains the true mean or it does not

Questions people ask

What does a 95 % confidence interval actually mean?
It means the method works 95 % of the time. If you repeated the whole exercise — new sample, same size, same population — and built an interval each time, about 95 of every 100 of those intervals would contain the true mean. The NIST handbook puts the negative plainly: a 95 % confidence interval does not mean there is a 95 % probability that the interval contains the true mean. The interval you have in front of you either contains it or it does not; the 95 % describes the procedure, not this particular pair of numbers.
So what can I not say about my interval?
Three things people say all the time and none of them follow. You cannot say 95 % of the data falls inside it — the interval is about the mean, not about individual values, and it is far narrower than the data. You cannot say a value outside it is impossible, only that it is not among the means this sample supports well. And you cannot say two groups differ because their intervals do not quite overlap, or that they do not differ because the intervals touch; comparing two groups needs a test on the difference, not an eyeball on two bars.
Why does the multiplier change with my sample size?
Because you estimated the standard deviation from the same handful of numbers. With very few observations that estimate is unreliable, so the interval has to be wider to keep its promise. At n = 2 the 95 % multiplier is 12.706; by n = 10 it is 2.262; by n = 30 it is 2.045, and it keeps creeping down towards 1.960 without ever reaching it.
Where do the t values come from, and what happens for large samples?
They are read straight from the table of critical values in the NIST/SEMATECH e-Handbook, which runs from 1 to 100 degrees of freedom. Past that, this page uses the normal values that the very same table prints in its last row for infinite degrees of freedom: 1.645, 1.960 and 2.576. That substitution is slightly generous to you. In the handbook's own worked example with 195 observations the exact t is 1.9723 against the normal 1.960, so an interval built the way this page builds it comes out about 0.6 % narrower than the exact one. Below 101 observations there is no approximation at all.
How do I make my interval narrower?
Collect more data, or accept less confidence. The margin shrinks with the square root of the sample size, so cutting it in half takes four times as many observations — going from 25 to 100 halves it, going from 100 to 400 halves it again. Dropping from 95 % to 90 % confidence narrows it by about a sixth, at the cost of being wrong twice as often.
Does this work when my data is not normally distributed?
Reasonably well, for a mean, if you have enough observations. The interval relies on the sample mean being roughly normally distributed, which happens for most data once the sample is large enough even when the data itself is skewed. It relies on it much more heavily for small samples, so an interval from eight strongly skewed values should be treated as a rough guide rather than a guarantee. It does not work at all for a median, a proportion or a variance — those have intervals of their own shape.

Related tools

Found a problem, or want more?

A number that disagrees with its source is a defect, not a rounding preference.

What did you enter, what did the tool show, and what did you expect instead? If you have a source that disagrees with ours, a link to it is the most useful thing you can send.

Write to us

Opens your mail app with the page and tool already filled in.