Confidence Interval Calculator
Z-based intervals using the standard normal distribution. Pairs with the z-test calculators (one-sample, two-sample, and proportion).
Z-based intervals using the standard normal distribution. Pairs with the z-test calculators (one-sample, two-sample, and proportion).
Mean · 95%
A factory measures bolt strength on 36 samples and finds x̄ = 100 N. With known σ = 15 N, build the 95% CI for the true mean.
Any value of μ inside this interval (e.g., μ₀ = 102) would not be rejected by a 95% one-sample z-test.
Difference of Means · 95%
Line A: x̄₁ = 105, σ₁ = 15, n₁ = 36. Line B: x̄₂ = 100, σ₂ = 12, n₂ = 49. Build the 95% CI for μ₁ − μ₂.
Because the interval contains 0, a 95% two-sample z-test of H₀: μ₁ = μ₂ would fail to reject — same data, two perspectives.
Proportion · 95%
A poll of 1,000 voters finds 520 in favor. Build the 95% Wald CI for the true support.
Because 0.50 is inside the CI, a 95% one-proportion z-test of H₀: p = 0.5 would fail to reject — the 52% sample share is consistent with a 50/50 split at this sample size.
Difference of Proportions · 95%
Variant A converts 80 of 200; variant B converts 60 of 200. Build the 95% CI for p₁ − p₂.
Because 0 is outside the CI, the companion 95% two-proportion z-test rejects H₀: p₁ = p₂. The CI also bounds the lift: somewhere between 0.7 and 19.3 percentage points.
Estimate a population mean μ from one sample when σ is known. The point estimate is x̄, the standard error is σ/√n, and z* is the critical value from the standard normal at the chosen confidence level. Pairs with the one-sample z-test.
x̄ ± z* × σ / √n
Estimate μ₁ − μ₂ from two independent samples (both σ's known). The CI does not assume the variances are equal. If the resulting interval excludes 0, the companion two-sample z-test rejects H₀: μ₁ = μ₂ at the same level.
(x̄₁ − x̄₂) ± z* × √(σ₁²/n₁ + σ₂²/n₂)
Estimate a population proportion p from one sample. The Wald form uses the *observed* p̂ in the standard error — the test calculator instead uses the hypothesized p₀, since under H₀ that is the assumed true value.
p̂ ± z* × √(p̂(1 − p̂)/n)
Estimate p₁ − p₂ from two independent samples using the unpooled (Wald) standard error. Pooling is only appropriate under H₀: p₁ = p₂ in the test setting; a CI does not assume equality. If the interval excludes 0, the two-proportion z-test rejects H₀ at the same level.
(p̂₁ − p̂₂) ± z* × √(p̂₁(1 − p̂₁)/n₁ + p̂₂(1 − p̂₂)/n₂)
A confidence interval is a range of plausible values for an unknown population parameter, computed from sample data. The calculator forms each interval as point estimate ± margin of error, where the margin of error is z* × standard error. The critical value z* comes from the standard normal at the chosen level — z_{0.975} ≈ 1.96 for a 95% interval, z_{0.995} ≈ 2.5758 for 99%, and so on. The standard error depends on which parameter you're estimating: σ/√n for a mean (known σ), √(σ₁²/n₁ + σ₂²/n₂) for a difference of means, √(p̂(1 − p̂)/n) for a proportion (Wald form), and √(p̂₁(1 − p̂₁)/n₁ + p̂₂(1 − p̂₂)/n₂) for a difference of proportions. Higher confidence levels widen the interval; larger samples narrow it. A 95% CI captures the true parameter in 95 out of every 100 hypothetical repetitions of the sampling procedure — it is not the probability that this particular interval contains the parameter.
A factory measures bolt strength on a sample of 36 bolts and finds x̄ = 100 N. The known process standard deviation is σ = 15 N. Construct a 95% confidence interval for the true mean tensile strength.
The CI gives more information than a p-value: it shows the precision of the estimate (interval width) and the set of null values that would *not* be rejected. Reporting a CI alongside a hypothesis-test result is standard practice.
Three quantities shape every confidence interval: the point estimate, the standard error, and the critical value z*. Higher confidence levels (99% vs. 95% vs. 90%) widen the interval — there is a fundamental tradeoff between confidence and precision. Larger samples shrink the standard error and tighten the interval. A CI's relationship to a hypothesis test at the same level is direct: any null value inside the interval would fail to reject; any null value outside would reject. This duality is why CIs are often considered more informative than p-values — they show the range of parameter values consistent with the data, not just whether one specific value is rejected. The Wald (normal-approximation) intervals computed here work well when sample sizes are large enough; for small n or proportions near 0 or 1, switch to a Wilson interval (proportions) or t-interval (means with σ unknown).
If we repeated the entire sampling procedure many times under the same conditions and constructed a 95% CI from each sample, about 95% of those intervals would contain the true population parameter. It is *not* the probability that this particular interval contains the parameter — once computed, the interval either does or does not.
A two-tailed z-test at significance level α and a (1 − α)·100% CI are duals: any null hypothesis value inside the CI fails to reject; any value outside rejects. So a 95% CI for the difference of means that excludes 0 corresponds exactly to the two-sample z-test rejecting H₀: μ₁ = μ₂ at α = 0.05.
Use a z-interval when the population standard deviation σ is known, or when the sample size is large (commonly n > 30) so the sample standard deviation is a reliable proxy. Use a t-interval when σ is unknown and n is small. The t-distribution has heavier tails, so t-intervals are wider for small samples.
A confidence interval estimates the unknown true proportion p, so the natural standard error uses the best available estimate p̂. A hypothesis test instead assumes H₀ is true and uses the hypothesized p₀ in the standard error — that's what makes the test statistic have a standard normal distribution under H₀. The two roles are different so the SE formulas differ.
Pooling is only appropriate when you assume p₁ = p₂ — that's the H₀ for the two-proportion z-test. A CI for the difference does not assume equality, so it uses each sample's own p̂ to compute the standard error. As a result the test SE and CI SE differ slightly even on the same data.
The margin of error scales as 1/√n. Doubling precision (halving the ME) requires four times the sample. For a target margin of error E, solve n ≈ (z* × σ / E)² for a mean or n ≈ (z*)² × p̂(1 − p̂) / E² for a proportion. Use a worst-case p̂ = 0.5 if you do not have a prior estimate.
A CI for μ₁ − μ₂ or p₁ − p₂ that includes 0 indicates that 'no difference' is among the plausible values at the chosen confidence level — equivalent to the companion two-sample z-test failing to reject H₀ at α = 1 − level. It is not proof of equality, just a statement that the data cannot distinguish the parameter from zero with the given precision.
Yes — the Wald CI is a symmetric ± interval, so for sample proportions near 0 or 1 it can extend outside [0, 1]. This is one of the Wald form's weaknesses. For small samples or extreme proportions, prefer a Wilson interval, which is asymmetric and stays within [0, 1].
Reference: All four intervals here are z-based (normal-approximation) and use the inverse standard normal CDF (Acklam's rational approximation) to obtain the critical z* at the chosen confidence level. The Wald form is used for proportion intervals; for small samples or proportions near 0 or 1, prefer a Wilson interval (not implemented here). For a single mean with σ unknown and small n, prefer a Student's t-interval (also outside this calculator's scope).