Confidence Interval Calculator
Choose the kind of estimate, enter your sample figures and confidence level, and get the interval, margin of error, critical value and standard error.
Lower limit
45.8722
Upper limit
54.1278
Margin of error (half-width)
4.1278
Point estimate
50
Critical value (z* or t*)
2.063899
Standard error
2
How it works
A confidence interval turns a single sample figure into a range that is likely to contain the true population value. A 95% interval is built by a procedure that captures the true value in 95% of samples; the margin of error is how far the interval reaches either side of the estimate.
For a mean the interval is the sample mean plus or minus a critical value times the standard error s ÷ √n. When the population standard deviation σ is genuinely known the critical value comes from the normal distribution (z* = 1.959964 for 95%). When the standard deviation is estimated from the sample, as it almost always is, the critical value comes from Student's t distribution with n − 1 degrees of freedom, which is wider for small samples to allow for that extra uncertainty. The t critical value is computed here from the t distribution's cumulative function, not read from a table.
For a proportion the standard error is √(p̂(1 − p̂) ÷ n). The Wald interval is simply p̂ ± z* × SE; it is the textbook formula but behaves badly for small samples or proportions near 0% or 100%. The Wilson score interval solves for the proportions whose normal test would not reject p̂, giving an interval that is not centred on p̂ but keeps its stated coverage much better.
Formula
z interval: x̄ ± z* × σ ÷ √n t interval: x̄ ± t*(n − 1) × s ÷ √n Wald: p̂ ± z* × √(p̂(1 − p̂) ÷ n) Wilson: (p̂ + z²/2n) ÷ (1 + z²/n) ± z ÷ (1 + z²/n) × √(p̂(1 − p̂)/n + z²/4n²) z* = Φ⁻¹(1 − α/2): 1.644854 (90%), 1.959964 (95%), 2.575829 (99%)
Example
A sample of 25 measurements has mean 50 and sample standard deviation 10. For 95% confidence with 24 degrees of freedom, t* = 2.063899 and the standard error is 10 ÷ √25 = 2, so the margin of error is 4.1278 and the interval is 45.8722 to 54.1278.
If σ = 10 were known, z* = 1.959964 gives a narrower margin of 3.9199 and an interval of 46.0801 to 53.9199.
A poll finds 52% support among 1,000 people. The standard error is √(0.52 × 0.48 ÷ 1000) = 0.015799, the 95% Wald margin is 1.959964 × 0.015799 = 3.0965 points, and the interval is 48.9035% to 55.0965%. The Wilson interval is 48.9018% to 55.0829%.
Assumptions and limitations
- The sample is a simple random sample from the population. Convenience samples and clustered samples have larger true margins than shown.
- The mean intervals assume the population is normal or the sample is large enough (roughly n ≥ 30) for the sample mean to be approximately normal.
- The Wald proportion interval needs roughly n × p̂ ≥ 10 and n × (1 − p̂) ≥ 10. Below that, or when p̂ is 0% or 100% (where Wald has zero width), use Wilson.
- For the Wilson interval the margin of error shown is half the interval's width; the interval is not centred on the sample proportion.
- Critical values: z* from Acklam's inverse-normal approximation refined with one Halley step; t* by bisection on the t distribution's cumulative function computed through the regularized incomplete beta function.
- A confidence interval does not say there is a 95% chance the true value is inside this particular interval; it says the method captures the true value in 95% of repeated samples.
Frequently asked questions
Should I use the z interval or the t interval for a mean?
Use t whenever the standard deviation was computed from the same sample, which is the usual situation. The z interval is only correct when σ is known from elsewhere, for example a long production history or an instrument specification. For large samples the two agree closely: with n = 1,000, t* is 1.962 against z* of 1.960.
Why does the Wilson interval differ from the Wald interval?
Wald assumes the sample proportion is exactly normal with the standard error computed from p̂ itself, which fails when p̂ is near 0% or 100% or n is small. Wilson uses the standard error at the hypothesised proportion instead, which pulls the interval towards 50% and keeps its actual coverage near the stated level. With 0 successes in 10 trials Wald gives 0% to 0%; Wilson gives 0% to 27.75%.
More in Math & Geometry calculators.