🔢 Math & Science

Confidence Interval Calculator

Calculate a confidence interval for a mean (z when σ is known, t when it isn't) or for a proportion. Shows the margin of error and the lower and upper bounds.

95% confidence interval

94.398908 to 105.60109

100 ± 5.601092

Margin of error

5.601092

Critical value (t (df = 29))

2.04523

Standard error

2.738613

Interval = estimate ± (critical value × standard error). The mean uses a z critical value when σ is known and a t value (df = n − 1) when it is estimated.

Frequently Asked Questions

How do I calculate a confidence interval for a mean?

Take the sample mean and add and subtract the margin of error: mean ± (critical value × standard error), where the standard error is the standard deviation divided by the square root of the sample size. Use a z critical value when the population standard deviation is known, and a t critical value (with n − 1 degrees of freedom) when it is estimated from the sample.

When do I use z versus t for a confidence interval?

Use z when you know the true population standard deviation (rare) or your sample is very large. Use t when you estimate the standard deviation from the sample, which is the usual case. The t-distribution has wider tails to account for the extra uncertainty, and it converges to z as the sample grows.

How do I calculate a confidence interval for a proportion?

Use p̂ ± z × √(p̂(1 − p̂) / n), where p̂ is the sample proportion and z is the critical value for your confidence level (1.96 for 95%). This is the standard Wald interval and works well when both n·p̂ and n·(1 − p̂) are at least about 10.

What does a 95% confidence interval mean?

It means that if you repeated the sampling process many times and built an interval each time, about 95% of those intervals would contain the true value. It does not mean there is a 95% probability that this particular interval contains the true value — the true value is fixed, the interval is what varies.

What is the margin of error?

The margin of error is the half-width of the confidence interval: the critical value times the standard error. A larger sample, a smaller standard deviation, or a lower confidence level all shrink the margin of error and produce a tighter interval.

How accurate is this calculator?

Z critical values come from an inverse-normal (probit) approximation accurate to about 1e-9, and t critical values are found by inverting the Student-t CDF (built on the regularized incomplete beta function). Both match standard statistical tables.