Confidence Interval Calculator

A confidence interval gives a range that is likely to contain the true population mean. Enter the sample mean, standard deviation, sample size and confidence level to get the interval and margin of error.

How it is calculated

Enter the sample mean, SD and size.

Choose the confidence level.

Read the interval and margin of error.

Formula

Interval: x̄ ± z × s ÷ √n

Standard error: SE = s ÷ √n

What is the Confidence Interval Calculator?

A sample mean is an estimate. Measure a different random sample and you will get a slightly different mean. A confidence interval puts a margin of error around the estimate, giving a range that is likely to contain the true population mean. This calculator takes the sample mean, standard deviation, sample size and a confidence level of 90%, 95% or 99%, and returns the interval, the margin of error, the standard error and the critical z value.

Confidence intervals appear in opinion polls, medical research, market surveys and lab reports, wherever someone wants to say not just 'the average is 168' but 'the average is 168, give or take 3'. They are part of college statistics, research methodology courses and the analysis section of most theses.

How to calculate it by hand

1. Find the sample mean x̄, the standard deviation s and the sample size n.

2. Compute the standard error: SE = s ÷ √n.

3. Pick the critical value z for your confidence level: about 1.645 for 90%, 1.96 for 95% and 2.576 for 99%.

4. Margin of error: ME = z × SE.

5. Interval: from x̄ − ME to x̄ + ME.

6. Report the level with the interval, for example '95% CI: 50.3 to 54.5'.

The standard error shrinks with √n

Individual values vary with standard deviation σ, but averages of n values vary much less, because highs and lows partly cancel. The spread of the sample mean, called the standard error, is σ ÷ √n. By the central limit theorem, the sample mean is close to normally distributed for moderately large n, even if the raw data is not. So about 95% of sample means fall within 1.96 standard errors of the true mean. Turning that around gives the interval x̄ ± 1.96 × SE. Because of the square root, halving the margin of error needs four times the sample.

What 95% confidence does and does not mean

The 95% describes the method, not one particular interval. If you repeated the whole sampling process many times and built an interval each time, about 95% of those intervals would contain the true mean. It does not mean there is a 95% probability that the true mean lies in the specific interval you computed; the true mean is fixed, and your interval either contains it or it does not. Higher confidence buys more certainty at the cost of a wider interval: a 99% interval is about 31% wider than a 95% one.

z interval versus t interval

This calculator uses the normal critical value z. That is exact when the population standard deviation is known and a very good approximation for large samples. When σ is unknown and estimated by s from a small sample, the extra uncertainty is handled by the t distribution with n − 1 degrees of freedom, whose critical values are larger. For n = 10 at 95%, t is about 2.26 compared with 1.96. Above about 30 observations the difference is small. The interval also assumes random sampling; a biased sample gives a precise answer to the wrong question.

Worked example, step by step

A sports science student in Chennai measured the heights of 64 randomly chosen Class 12 boys and found a mean of 168.2 cm with a standard deviation of 9.5 cm. She wants a 99% confidence interval for the average height of all Class 12 boys in the district.

Standard error: SE = s ÷ √n = 9.5 ÷ √64 = 1.1875

Critical value for 99%: z = 2.5758

Margin of error: ME = z × SE = 2.5758 × 1.1875 = 3.058797

Interval: 168.2 ± 3.0588 = (165.1412, 171.2588)

Answer: 99% confidence interval 165.1412 to 171.2588; Margin of error ± 3.0588; Standard error 1.1875

Common mistakes to avoid

Dividing the standard deviation by n instead of √n when computing the standard error.

Saying there is a 95% chance the true mean is in this particular interval.

Using z for a very small sample with an unknown population SD, where a t interval is wider and more honest.

Treating a convenience sample, such as friends or one classroom, as if it were random.

Reading the interval as the range where 95% of individual values lie; that is a much wider prediction range.

Where it is used

Reporting survey and poll results with a margin of error.

Presenting treatment effects and averages in medical and social science research.

Estimating average yield, weight or strength from samples in agriculture and manufacturing.

Lab reports that give a mean value with its uncertainty.

Checking whether a target value, such as a specified mean weight, is consistent with the data.

Frequently asked questions

How do I halve the margin of error?

Quadruple the sample size, because the margin shrinks with √n.

When should I use a t-interval instead?

For small samples when the population SD is unknown; the t critical value is larger than z.