Confidence Interval Calculator

Confidence interval for a mean (known σ with z, or sample SD with t) or a proportion, with margin of error and critical value.

Calculated with n − 1 (the usual “sample” standard deviation).

Results

95% confidence interval
46.42 to 53.58
Lower limit
46.423
Upper limit
53.577
Margin of error (error bound)
3.5768
Critical value t (95%, df = 9)
2.2622
Sample mean
50
Degrees of freedom (n − 1)
9

How it’s calculated

A confidence interval is a range built around a sample statistic. If you repeated the sampling many times, about the stated percentage of intervals built this way would contain the true value. The half-width is the margin of error (OpenStax calls it the error bound).

Mean, σ known: x̄ ± z × σ ÷ √n Mean, σ unknown: x̄ ± t × s ÷ √n (t has n − 1 degrees of freedom) Proportion (Wald): p′ ± z × √( p′(1 − p′) ÷ n ), p′ = x ÷ n Proportion (Wilson): ( p′ + z²/2n ± z × √( p′(1 − p′)/n + z²/4n² ) ) ÷ ( 1 + z²/n )

The critical values z and t come from the inverse normal and Student's t distributions (computed here from the regularized incomplete beta function, so any sample size works, not just table rows). Typical z values: 1.282 (80%), 1.645 (90%), 1.960 (95%), 2.326 (98%), 2.576 (99%). The t value is larger for small samples: t = 2.262 for 95% with 9 degrees of freedom.

For a proportion you can choose the Wilson score interval (the default, recommended by the NIST handbook) or the simple Wald interval taught in introductory courses. Wald is fine with plenty of data, but with fewer than 5 successes or failures it is unreliable, and with 0 or all successes it collapses to a single point, which is misleading. Wilson stays sensible there (for 0 of 20 at 95% it gives 0% to 16.1%). Both are cut off at 0% and 100%.

Example: a sample of n = 10 has mean 50 and s = 5. With 95% confidence and df = 9, t = 2.2622, so the margin of error = 2.2622 × 5 ÷ √10 = 3.577 and the interval is 46.42 to 53.58.

Frequently asked questions

When do I use z and when t?

Use z only when the true population standard deviation is known (rare in practice). When you estimate it from your sample with s, use t, which gives a slightly wider interval to account for that extra uncertainty. For large samples the two are nearly the same.

What does a 95% confidence interval mean?

It does not mean there is a 95% chance the true value is in this particular interval. It means the method captures the true value in 95% of repeated samples. A higher confidence level gives a wider interval.

How do I make the interval narrower?

Collect a larger sample (the margin shrinks with √n), accept a lower confidence level, or reduce variability in your measurements.

Does the t method need normal data?

The t interval assumes the population is roughly normal, but it is robust for moderate to large samples (about 30 or more). With very small samples and strongly skewed data, treat the result with caution.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator