In short
A confidence interval is an estimate plus or minus a margin of error. For a mean, the margin is a critical value times the standard error, s ÷ √n. For a proportion it is z times √(p̂(1 − p̂) ÷ n). A 95% level means that intervals built this way capture the true value in 95% of samples, not that this one has a 95% chance.
How it works
x̄ ± t(1 − α/2, n − 1) × s ÷ √n x̄ ± z(1 − α/2) × σ ÷ √n
p̂ ± z × √(p̂(1 − p̂) ÷ n)
α is 1 minus the confidence level, so a 95% interval uses the 97.5th percentile: z = 1.96, or t with n − 1 degrees of freedom when the standard deviation comes from the sample, as the NIST/SEMATECH handbook does. OpenStax uses z with a known σ. For proportions, the calculator also gives the Wilson interval, which NIST recommends because it behaves better for small samples and proportions near 0 or 1.
Worked examples
195 measurements, mean 9.261460, s = 0.022789
t(0.975, 194) = 1.9723, so the 95% interval is (9.2582413, 9.2646787). The NIST/SEMATECH handbook prints (9.258242, 9.264679) from the unrounded data.
Mean 68, σ = 3, n = 36, 95%
1.96 × 3 ÷ 6 ≈ 0.98, giving (67.020018, 68.979982), which OpenStax Introductory Statistics Example 8.4 rounds to (67.02, 68.98).
421 of 500 people said yes, 95%
p̂ = 0.842, and the interval is (0.81003, 0.87397), about 81.0% to 87.4% (Example 8.10). The Wilson interval is (0.80744, 0.87135).
Using this calculator well
- Wider is more confident. Raising the level from 90% to 99% widens the interval; collecting more data narrows it, by a factor of √n.
- Use t when the standard deviation comes from your data, which is almost always. With large samples t and z give nearly the same answer.
- Random samples only. No formula fixes a biased sample, such as a poll that only reaches people who volunteer.
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 value. Any single interval either contains it or not; the 95% describes how reliable the method is.
What is the margin of error?
It is half the width of the interval: the critical value times the standard error. A poll reporting 52% with a margin of 3 points means the interval is 49% to 55%. Quadrupling the sample size halves the margin.
When should I use t instead of z?
Use t when the standard deviation is estimated from the sample, which is the usual case. The t distribution has heavier tails, so its critical values are larger for small samples: 2.228 with 10 degrees of freedom versus 1.96 for z at 95%.
What are the z values for 90%, 95% and 99%?
They are 1.645, 1.960 and 2.576, the points that leave 5%, 2.5% and 0.5% in each tail of the standard normal curve. This calculator computes them, and the t values, for any confidence level you enter.
Sources and methodology
- Introductory Statistics 2e, 8.1 A Single Population Mean Using the Normal Distribution and 8.3 A Population Proportion, OpenStax, Rice University, x̄ ± z·σ/√n (§8.1, Example 8.4: 68, σ = 3, n = 36, 95% → (67.02, 68.98); Example 8.3: 1.024, 0.337, 30, 98% → (0.8809, 1.1671)); p′ ± z√(p′q′/n) (§8.3, Example 8.10: 421 of 500, 95% → (0.810, 0.874); Example 8.11: 300 of 500, 90% → (0.564, 0.636)) (accessed November 24, 2026)
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2 Confidence Limits for the Mean and 7.2.4.1 Confidence Intervals (proportions), National Institute of Standards and Technology, Ȳ ± t(1−α/2, N−1)·s/√N; N = 195, mean 9.261460, s = 0.022789, t = 1.9723 → (9.258242, 9.264679); Wilson interval for a proportion (§7.2.4.1: p̂ = 0.13, n = 200, one-sided lower limit 0.09577); t table §1.3.6.7.2 (accessed November 24, 2026)
Rounding: Critical values are computed to about 15 digits rather than read from a table. Mean intervals are shown to 8 significant digits and proportions to 5 decimals.
Review status: formulas verified against the cited sources by automated tests; editorial review pending. Version 1.0.0, content updated November 24, 2026.
Changelog
- 1.0.0 · November 24, 2026: First published.
How we build and test calculators
Embed this calculator on your site
Paste this code into your page. The calculator runs in a frame, with no tracking and no cookies, and links back here for the formula and sources.
<iframe src="https://northcalculator.com/embed/en/confidence-interval" title="Confidence Interval Calculator" width="100%" height="760" style="border:0" loading="lazy"></iframe>