Skip to content
Mathico

Confidence Interval Calculator

Calculate a confidence interval for a mean (t or z) or a proportion (Wald and Wilson). Enter your sample statistics and confidence level to get the interval, margin of error, standard error and critical value.

Interval for a
Standard deviation is
Confidence level

95% confidence interval

45.8722 to 54.1278

50 ยฑ 4.1278

Margin of error
4.1278
Standard error
2
Critical value t* (df = 24)
2.0639
Method
t interval

Interpretation: if you repeated the sampling many times, about 95% of intervals built this way would contain the true mean.

How to use the confidence interval calculator

  1. Choose a mean or a proportion.
  2. For a mean, enter the sample mean, standard deviation and sample size, and say whether ฯƒ is known (z) or estimated from the sample (t). For a proportion, enter the number of successes and the sample size.
  3. Pick a confidence level (90%, 95%, 99% or your own) and read the interval, margin of error, standard error and critical value.

Confidence interval formulas

Mean, ฯƒ unknown: xฬ„ ยฑ t* ร— s รท โˆšn (df = n โˆ’ 1)
Mean, ฯƒ known: xฬ„ ยฑ z* ร— ฯƒ รท โˆšn
Proportion (Wald): pฬ‚ ยฑ z* ร— โˆš(pฬ‚(1 โˆ’ pฬ‚) รท n)
Proportion (Wilson): [pฬ‚ + zยฒ/2n ยฑ zโˆš(pฬ‚(1 โˆ’ pฬ‚)/n + zยฒ/4nยฒ)] รท (1 + zยฒ/n)

Worked examples

Mean: xฬ„ = 50, s = 10, n = 25, 95% confidence

SE = 10 รท โˆš25 = 2 ยท t* (df 24) = 2.0639
Margin of error = 2.0639 ร— 2 = 4.128 โ†’ CI = 45.87 to 54.13

If ฯƒ = 10 were known, z* = 1.960 would give a slightly narrower 46.08 to 53.92.

Proportion: 520 of 1,000 say yes, 95% confidence

pฬ‚ = 0.52 ยท SE = โˆš(0.52 ร— 0.48 รท 1,000) = 0.0158
Margin of error = 1.96 ร— 0.0158 = 0.031 โ†’ 48.9% to 55.1%

Small sample: 3 of 20

The simple formula gives โˆ’0.6% to 30.6%, an impossible negative lower bound. The Wilson interval gives a sensible 5.2% to 36.0%, which is why the calculator shows both.

Common critical values

Confidencez*t* (df 10)t* (df 30)
90%1.6451.8121.697
95%1.9602.2282.042
99%2.5763.1692.750

Assumptions

  • Random sample of independent observations.
  • Means: the data are roughly normal, or n is large enough (often n โ‰ฅ 30) for the sample mean to be approximately normal.
  • Proportions: the Wald interval needs at least about 10 successes and 10 failures; otherwise use Wilson.

The standard error uses a square root; check it by hand with the square root calculator. To draw a random sample, the random number generator can pick unique IDs. Survey results often come as ratios; convert them with the ratio calculator. More math calculators.

Sources

Frequently asked questions

How do you calculate a confidence interval?

Confidence interval = estimate ยฑ critical value ร— standard error. For a mean, the standard error is s รท โˆšn and the critical value comes from the t distribution (or z if the population standard deviation is known). With xฬ„ = 50, s = 10 and n = 25 at 95%: 50 ยฑ 2.064 ร— 2 = 45.87 to 54.13.

What does a 95% confidence interval mean?

It means the method captures the true value 95% of the time: if you took many samples and built an interval from each, about 95% of them would contain the true population value. It doesn't mean there's a 95% chance the true value lies in this particular interval.

When should I use t instead of z?

Use t when you estimate the standard deviation from your sample, which is almost always. Use z only when the population standard deviation is genuinely known. With large samples the two give nearly the same answer: t* for 1,000 degrees of freedom is 1.962 versus z* = 1.960.

What are the critical values for 90%, 95% and 99%?

For z: 1.645 (90%), 1.960 (95%) and 2.576 (99%). For t they're larger and depend on degrees of freedom (n โˆ’ 1); for example, at 95% t* is 2.064 with 24 degrees of freedom and 12.706 with 1.

How do I calculate a confidence interval for a proportion?

pฬ‚ ยฑ z* ร— โˆš(pฬ‚(1 โˆ’ pฬ‚) รท n). With 520 successes out of 1,000 at 95%: 0.52 ยฑ 1.96 ร— 0.0158 = 0.489 to 0.551, or about 48.9% to 55.1%. For small samples or proportions near 0 or 1, the Wilson score interval is more accurate.

How can I make a confidence interval narrower?

Increase the sample size (quadrupling n halves the margin of error), reduce variability with better measurement, or accept a lower confidence level. A 90% interval is narrower than a 95% one, but it captures the true value less often.

What is the margin of error?

The margin of error is the ยฑ part of the interval: critical value ร— standard error. A poll reporting 52% ยฑ 3.1 points at 95% confidence has a margin of error of 3.1 percentage points.