Confidence Interval Calculator

Enter your sample size, mean and standard deviation to get the margin of error and the confidence interval for the true average.

What a confidence interval is really saying

You measured a sample, not everyone. The sample mean is your best single guess for the true average of the whole group, but it will not be exactly right. A confidence interval puts a range around that guess. A 95% interval means that if you repeated the whole sampling process many times, about 95 out of 100 of the intervals built this way would contain the true mean. Strictly speaking the 95% describes the method, not this one interval. In everyday use, read it as "the true value is probably somewhere in here", and a higher confidence level gives a wider range.

A worked example you can follow

Say you timed 50 customers at the checkout. The average wait was 20.6 minutes with a standard deviation of 3.2. The standard error is 3.2 ÷ √50 = 0.4525. For a 95% interval the z-value is 1.96, so the margin of error is 1.96 × 0.4525 = 0.887 minutes. The interval runs from 19.713 to 21.487 minutes. In plain words: the typical wait across all customers is probably between about 19.7 and 21.5 minutes.

z or t? Choosing the right critical value

The calculator defaults to the z-value, which is correct when the population standard deviation is known or the sample is large (30 or more is the common rule of thumb). With a small sample where you only have the sample standard deviation s, the t-distribution is the better choice. It gives a slightly larger critical value, so the interval is a little wider and more honest about the extra uncertainty. For example, with 10 values a 95% interval uses t = 2.262 instead of 1.96, which makes the margin of error about 15% larger. Tick the t-distribution box to see the difference on your own numbers.

How to make the interval narrower

There are two levers. You can lower the confidence level, since 90% gives a tighter range than 99% (the z-values are 1.645, 1.960 and 2.576 for 90%, 95% and 99%), but that makes you less sure. Or you can collect more data. The margin of error shrinks with the square root of the sample size, so to cut it in half you need four times as many observations. If you are still planning a study, the Sample Size Calculator works backward from the margin of error you want to the number of people you need.

Getting the inputs from your data

If you have raw numbers rather than a ready-made mean and standard deviation, paste them into the Statistics Calculator or the Standard Deviation Calculator and copy the count, mean and sample standard deviation across. To see where the 1.96 comes from, the Z-score Calculator converts a confidence level into its z-value, since 95% leaves 2.5% in each tail.

What this calculator does not cover

This is the interval for a mean. It does not cover a proportion, such as "52% of voters prefer option A", which uses a different formula. It also assumes the sample was random and the data is roughly bell-shaped or the sample is large enough that the average behaves normally. A confidence interval cannot fix a biased sample: if you only asked the people who were easy to reach, the interval will be neatly centred on the wrong answer.

For samples smaller than 30, the calculator shows a reminder. If you only have the sample standard deviation, tick the t-distribution box so the interval is not too optimistic.

Common questions

How do you calculate a confidence interval?

Take the sample mean and add and subtract the margin of error. The margin of error is the critical value (z or t) times the standard deviation divided by the square root of the sample size.

What is the z-value for a 95% confidence interval?

It is 1.96. For 90% it is about 1.645 and for 99% it is about 2.576.

What does a 95% confidence level mean?

It means the method used would capture the true mean in about 95 out of 100 repeated samples. A higher level gives a wider interval.

When should I use the t-distribution instead of z?

Use t when the sample is small, usually under 30, and you only know the standard deviation from the sample. For large samples the two give almost the same answer.

How does sample size affect the margin of error?

A larger sample gives a smaller margin of error. Because of the square root, you need four times the sample size to halve the margin.

More Math Calculators

Pick another tool to jump straight to it.