TTKTheTextKit

Confidence Interval Calculator

Work out a confidence interval for a mean from the sample mean, standard deviation and size, or paste your raw numbers and let the tool find them. For a proportion, enter the successes and trials and choose the Wilson, exact or Wald method. You get the interval, the margin of error and the critical value. Everything runs in your browser.

95% confidence interval
45.8722 to 54.1278
Margin of error
4.1278
Half the width of the interval
Standard error
2
s divided by the square root of n
t critical value
2.0639
24 degrees of freedom

With the normal z value of 1.96 instead of t, the margin would be 3.91993, too narrow for a sample this size. The t distribution gives wider intervals for small samples.

A confidence interval is a range built from a sample that would contain the true value in about 95 percent of repeated samples if the confidence level is 95. It does not mean there is a 95 percent chance the true value lies in this one range. For a mean the interval is the sample mean plus or minus a t value times the standard error, using Student's t distribution because the true standard deviation is unknown. For a proportion, the Wilson and exact methods stay reliable for small samples and for results near 0 or 100 percent, where the simple Wald formula fails. Everything is worked out in your browser and nothing is uploaded.

Related Tools

[5 suggestions]

About the Confidence Interval Calculator

A confidence interval is a range of plausible values for an unknown quantity, built from a sample. A 95 percent interval is made by a procedure that captures the true value in about 95 percent of repeated samples. It does not say there is a 95 percent chance the true value is in this particular range. For a mean, the interval is the sample mean plus or minus a critical value times the standard error, where the standard error is the sample standard deviation divided by the square root of n. Because the true standard deviation is not known, the critical value comes from Student's t distribution with n minus 1 degrees of freedom, not from the normal curve. It is larger for small samples: with 24 degrees of freedom the 95 percent value is 2.0639, against 1.96 for the normal curve. For a sample of 25 with mean 50 and standard deviation 10, the margin of error is 4.13 and the interval is 45.87 to 54.13. Any confidence level from above 0 to below 100 works, because the critical values are calculated, not looked up. For a proportion, the simple Wald formula is unreliable for small samples and for results near 0 or 100 percent. The Wilson score interval is a better default, and the exact Clopper-Pearson interval guarantees at least the stated coverage and is the widest. With 0 successes in 10 trials, Wald gives an interval of zero width, Wilson gives 0 to 27.75 percent, and the exact method gives 0 to 30.85 percent. A wider interval comes from a higher confidence level, more variable data or a smaller sample.

How do I calculate a confidence interval for a mean?▾

Find the sample mean and standard deviation, divide the standard deviation by the square root of n to get the standard error, and multiply by the t value for n minus 1 degrees of freedom. Add and subtract the result from the mean.

Should I use z or t?▾

Use t whenever the population standard deviation is estimated from the sample, which is almost always. The t value is larger for small samples and approaches the normal z value, 1.96 at 95 percent, as n grows.

What does a 95 percent confidence interval mean?▾

The method used to build it captures the true value in about 95 percent of repeated samples. It is not the probability that the true value lies in this one interval.

Which method should I use for a proportion?▾

Wilson is a good default. Use the exact Clopper-Pearson method when you need guaranteed coverage. Avoid Wald for small samples or when the result is near 0 or 100 percent.

How do I make a confidence interval narrower?▾

Collect a larger sample, because the margin shrinks with the square root of n, or accept a lower confidence level. Less variable data also gives a narrower interval.

Is my data uploaded?▾

No. The calculation runs in your browser and nothing you enter is sent anywhere.