Guide
Confidence intervals for a mean and for a proportion, and how the methods differ
A sample mean or a sample proportion is only an estimate of the real value. A confidence interval puts a range around the estimate that reflects how precisely the sample pins it down, and the margin of error is half the width of that range. Poll results, laboratory averages and quality checks all report them. This calculator builds the interval for a mean from summary numbers or pasted data, or for a proportion with four recognised methods.
The interval for a mean
For a mean the interval is m ± t*·s/√n, where s/√n is the standard error and t* is the critical value of the t distribution with n − 1 degrees of freedom at your confidence level. With mean 50, standard deviation 10 and n = 25, the standard error is 2, t* is 2.0638986 and the 95% interval is 45.872203 to 54.127797, a margin of ±4.1277971. Choose z instead of t only when the population deviation is known or n is large.
Using the tool
Under Interval for, choose A mean (from mean, SD and n), A mean (from raw data) or A proportion, then the Confidence level from 80% to 99.9%. For raw data, paste the values separated by spaces, commas or lines; eight values of 12.1 14.3 13.8 15.2 12.9 14.7 13.3 15.0 give mean 13.9125, standard deviation 1.0894789 and a 95% interval of 13.001673 to 14.823327 with t* = 2.3646243 on 7 degrees of freedom. A table shows the same data at all five levels.
The interval for a proportion
For x successes in n trials the sample proportion is x/n. The Wald interval, p ± z√(p(1 − p)/n), is the textbook formula but fails for small counts and for proportions near 0 or 1. The Wilson score interval fixes this, the Agresti-Coull interval adds pseudo-observations, and the Clopper-Pearson interval is exact, based on the binomial distribution, and guarantees coverage of at least the stated level. The default Wilson interval is a good everyday choice.
Worked examples
A poll with 45 of 100 respondents in favour gives a proportion of 0.45 and a Wilson 95% interval of 0.356145 to 0.547554, that is 35.61% to 54.76%, a margin of ±9.57%. The exact interval is 0.35032 to 0.55272 and Agresti-Coull gives 0.356128 to 0.547571. For 3 successes in 10 trials the exact interval is 0.0667395 to 0.652453 while Wilson gives 0.107791 to 0.603222, showing how methods spread apart when counts are small. A warning appears if there are fewer than ten successes or failures.
Choosing the confidence level
Higher confidence costs width. For the default data the margins at 80%, 90%, 95% and 99% are ±2.63567, ±3.42176, ±4.1278 and ±5.59388: going from 95% to 99% widens the interval by about a third. A 95% level is the usual convention, 99% is chosen when a wrong conclusion is costly, and 90% is common in exploratory work. State the level whenever you quote an interval.
Margin of error and sample size
The margin of error shrinks with the square root of the sample size: quadrupling the sample halves it. If an interval is too wide to be useful, the cure is more data, or less variable data, rather than a lower confidence level. The sample size calculator works backwards from the margin you want. Remember that the margin reflects random sampling error only, not bias from who answered or how the question was worded.
Limits
The mean interval assumes the data are roughly normal or the sample is large enough for the central limit theorem to help; strongly skewed small samples need another method. Proportion intervals assume independent trials with the same chance of success. The tool does not build intervals for medians, differences between groups or regression coefficients, though the t-test and regression tools report the last two.
Related tools
- Z-Score Calculator explains where the critical z values come from.
- Sample Size Calculator finds the sample needed for a target margin of error.
- Standard Error Calculator shows the standard error and intervals from raw data.
- A/B Test Calculator compares two proportions with an interval for the difference.
Checked against the current version of the Confidence Interval Calculator on .

