What the Confidence Interval and Sample Size Calculator does
A confidence interval gives a range that is likely to contain the true value you are estimating from a sample. The Confidence Interval Calculator works it out for a mean, using the t distribution when the standard deviation comes from your sample, or for a proportion, such as the share of people in a survey who said yes. Its sample size mode answers the planning question: how many people do I need to survey for a given margin of error?
How to use it
- Choose an interval for a mean, a proportion, or the sample size.
- Choose the confidence level; 95% is the usual choice.
- Enter your sample results, or the margin of error you want.
- Read the interval or the sample size, with the working.
Example
A sample of 40 with mean 52.4 and standard deviation 8.1 gives a 95% interval of 49.81 to 54.99, using t = 2.023 with 39 degrees of freedom. For a survey with a ±3% margin of error at 95% confidence, you need 1,068 responses, or 880 if the whole population is only 5,000.
The formulas
For a mean, the interval is x̄ ± t × s ÷ √n, where s ÷ √n is the standard error. For a proportion, it is p ± z × √(p(1 − p) ÷ n). For sample size, n = z² × p(1 − p) ÷ E², and with a known population N, the result is reduced to n ÷ (1 + (n − 1) ÷ N).
Higher confidence gives a wider interval; a bigger sample gives a narrower one. Halving the margin of error needs about four times the sample.
Questions people ask
Is anything I enter sent anywhere?
No. The calculator works entirely in your browser, so your numbers stay on your device.
Does 95% confidence mean a 95% chance the true value is in my interval?
Strictly, it means that 95% of intervals made this way from repeated samples would contain the true value. In everyday use, it is a good guide to how precise your estimate is.
Why use the t distribution?
When the standard deviation is worked out from the sample itself, small samples are less certain, and the t distribution widens the interval to allow for that. For large samples, t and z are almost the same.