📊 Confidence Interval Calculator
A confidence interval is the range a sample supports, not a guess with a cushion. This calculates one for a mean or a proportion at any confidence level, and shows the margin of error separately.
What a confidence interval actually claims
A confidence interval is a range calculated from a sample that is designed to contain the true population value a stated proportion of the time. The subtle and widely misreported part is what the percentage refers to: it describes the method, not any particular interval.
interval = estimate ± z × standard error
The correct interpretation
A 95% confidence interval does not mean there is a 95% probability the true value lies inside this particular range. The true value is fixed; it is either in there or it is not. What is true is that if you repeated the sampling procedure many times, 95% of the intervals produced would contain it. The confidence is in the method.
In everyday reporting the distinction rarely changes the decision, which is why the loose interpretation survives. It matters when people treat a single interval as a probability distribution over the true value, which is a Bayesian credible interval and a different calculation.
The two cases
| Estimating a | Standard error | Example |
|---|---|---|
| Mean | s / √n | Average test score, average height |
| Proportion | √(p(1−p)/n) | Share voting yes, conversion rate |
Both shrink with the square root of the sample size, which is the single most consequential fact about sampling. To halve the margin of error you need four times the sample, and to quarter it you need sixteen times.
Why polls are always around ±3%
| Sample size | Margin of error |
|---|---|
| 100 | ±9.8 points |
| 400 | ±4.9 points |
| 1,000 | ±3.1 points |
| 2,000 | ±2.2 points |
| 5,000 | ±1.4 points |
| 10,000 | ±1.0 points |
A thousand respondents is the industry standard because it is where the curve flattens. Going from 1,000 to 2,000 doubles the cost to improve the margin by less than a point. It is also why a poll showing 48% against 45% with a ±3 point margin is not showing a lead.
Confidence level is a trade-off
| Confidence | z value | Interval width relative to 95% |
|---|---|---|
| 90% | 1.645 | 84% |
| 95% | 1.960 | 100% |
| 99% | 2.576 | 131% |
| 99.9% | 3.291 | 168% |
Higher confidence means a wider interval. You can always be more certain by being less precise, and at 100% confidence the interval covers everything and says nothing. The 95% convention is arbitrary but useful: it is tight enough to be informative and loose enough to be achievable.
What the interval does not cover
Margin of error accounts only for random sampling variation. It says nothing about a biased sample, a leading question, non-response from people who differ from responders, or a badly defined population. Those are usually the larger errors in real surveys, and no amount of sample size fixes them. A poll of 10,000 people recruited badly is worse than a poll of 800 recruited well.
A worked example
A sample of 200 with a mean of 72.5 and a standard deviation of 9.4. The standard error is 9.4 / √200 = 0.665. At 95% confidence the margin is 1.96 × 0.665 = 1.30, so the interval runs 71.20 to 73.80. To halve that margin to ±0.65 you would need 800 observations, and to reach ±0.33 you would need 3,200.
The natural follow-ups are the z-score calculator, for what this figure feeds into, and the standard deviation calculator, for the closely related case.
Frequently Asked Questions (FAQs)
What does a 95% confidence interval mean?
That if the sampling procedure were repeated many times, 95% of the intervals produced would contain the true population value. It is a statement about the method, not a 95% probability that this specific interval contains the true value.
How do I reduce the margin of error?
Increase the sample size, which is the main lever, or accept a lower confidence level. Because the error shrinks with the square root of n, halving it requires quadrupling the sample. Reducing variability in the measurement also helps where that is possible.
What sample size do I need?
For a proportion at 95% confidence, roughly (1.96/E)² × 0.25 where E is the margin you want as a decimal. For ±3 points that is about 1,067, and for ±5 points about 384. The 0.25 assumes the worst case of a 50% proportion.
Why do two polls disagree when both have a ±3% margin?
Because ±3 points on each means the two could differ by six points from sampling variation alone, before any difference in method, weighting or question wording. Disagreement within that range is expected rather than surprising.
Should I use z or t?
Z when the sample is large, above about 30, or the population standard deviation is known. T when the sample is small and you estimated the standard deviation from it. For a sample of 20, using z makes the interval about 5% too narrow.
Does a bigger sample fix a biased one?
No, and this is the most important limitation. Margin of error measures random variation only. Selection bias, non-response bias and leading questions are not reduced by sampling more people; a larger biased sample is simply more precisely wrong.