Confidence Interval Calculator
Confidence intervals for a mean (t or z) or a proportion (Wilson).
About this tool
Choose an interval for a mean or for a proportion, and a confidence level from 80% to 99.9%. For a mean, enter the sample mean, standard deviation and sample size, and tick the box if the population standard deviation is known. For a proportion, enter the number of successes and the sample size. You get the interval, the margin of error, the standard error and the critical value used.
How confidence intervals work
A confidence interval is a range of plausible values for a population figure, worked out from a sample. For a mean it is xฬ ยฑ critical value ร standard error, where the standard error is s รท โn. When the population standard deviation is unknown, which is usual, the critical value comes from Student's t distribution with n โ 1 degrees of freedom. That is wider than the normal value for small samples: t = 2.023 for 40 observations at 95%, against z = 1.960. A sample of 40 with a mean of 72.4 and a standard deviation of 8.5 gives a 95% interval of about 69.7 to 75.1. For proportions, the Wilson score interval is recommended because it behaves well near 0% and 100% and for small samples. 312 successes out of 800 is 39%, with a 95% Wilson interval of about 35.7% to 42.4%. The meaning of 95% confidence is subtle. The method captures the true value in 95% of repeated samples, which is not quite the same as a 95% chance that this particular interval contains it. Honest limits: the formulas assume a random sample, and for small samples of means, roughly normal data. The sample size calculator plans how many to survey, the z-score calculator converts critical values and the A/B test calculator compares two groups. Standard deviation explained: what it measures, how it's calculated, and the 68โ95โ99.7 rule explains the spread behind the standard error.
Frequently asked questions
How do I calculate a 95% confidence interval?
For a mean: xฬ ยฑ t ร s/โn, with t from the t distribution with n โ 1 degrees of freedom (about 1.96 for large samples). For a proportion, use the Wilson interval.
What is the margin of error?
Half the width of the confidence interval: the critical value times the standard error.
When should I use t instead of z?
Use t when you estimate the standard deviation from the sample, which is almost always. Use z only if the population standard deviation is genuinely known.
Is my data saved?
No. Everything runs in your browser and nothing is stored or sent.