Confidence interval calculator

90%, 95% and 99% confidence intervals for a mean or a proportion, plus the sample size you need.

  • ๐Ÿ‡บ๐Ÿ‡ธ US federal & state rules
  • See sources

If you only have the sample SD, pick unknown and the t distribution is used.

Same units as the mean, or percentage points for a proportion. Shows the sample size you need.

Example

95% confidence interval

46.2659 to 53.7341

50 ยฑ 3.7341

Margin of error (ยฑE)
3.7341
Critical value
t = 2.0452 (df 29)
Standard error
1.8257

This is an example. Enter your numbers above and press the button to see your own result.

  • Assumes a random sample from a population that is roughly normal, or a sample large enough for the central limit theorem.
  • Critical values are computed directly, so they can differ from a printed table in the third decimal place.
Show the math
DistributionPopulation SD unknown, so t with n - 1 degrees of freedom
Standard errorSE = s รท โˆšn = 10 รท โˆš30 = 1.8257
Margin of errorE = 2.0452 ร— 1.8257 = 3.7341
Interval50 ยฑ 3.7341

What to do next

How it works

For a mean, the interval is xฬ„ ยฑ critical value ร— s รท โˆšn. When the population SD is unknown, the critical value comes from the t distribution with n - 1 degrees of freedom. For a proportion, the interval is p ยฑ z ร— โˆš(p(1 - p) รท n), and the Wilson interval is shown as well.

The required sample size is (z ร— ฯƒ รท E)ยฒ for a mean and zยฒ ร— p(1 - p) รท Eยฒ for a proportion, rounded up. With t, the calculation repeats with the new degrees of freedom until n stops changing, as NIST describes.

df90%95%99%
16.31412.70663.657
22.9204.3039.925
52.0152.5714.032
101.8122.2283.169
301.6972.0422.750
601.6712.0002.660
1001.6601.9842.626
โˆž1.6451.9602.576

Things to keep in mind

The math assumes a random sample. A low response rate or a sample that leans toward one group can be far from the truth even with a narrow interval.

There is no finite population correction, which matters only when your sample is a large share of the whole population.

Sources

Frequently asked questions

What does a 95% confidence interval mean?

If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true mean. It does not mean there is a 95% chance the true value is in this one interval.

When do I use z and when do I use t?

Use z when you know the population standard deviation and t when you estimate it from the sample. At 95%, t is 2.045 with 29 degrees of freedom and 1.984 with 100, getting closer to z = 1.960 as n grows.

How is a poll's margin of error calculated?

For 1,000 people and a 50% result at 95% confidence, it is 1.96 ร— โˆš(0.5 ร— 0.5 รท 1,000), about ยฑ3.1 points. Pick Proportion and enter 50 and 1000 to check.

How big a sample do I need?

The margin of error shrinks with the square root of n, so halving it takes four times the sample. A ยฑ3 point poll at 95% needs 1,068 people when you assume 50%.

Related tools