Statistics · Inference
Confidence Interval
Calculator
Calculate confidence intervals for population mean, proportion, and two-sample comparisons — with z or t-distribution, step-by-step solutions, visual interval bar, and multi-level comparison.
—
CI Interval
—
Margin of Error
—
Confidence
CI for Population Mean
Distribution
n
x̄
σ/s
CI for Population Proportion
n
x
Sample proportion p̂ = x/n = 0.6 | Uses z-distribution (normal approximation)
CI for Difference of Two Means
CI for μ₁ − μ₂. Assumes independent samples and known or equal σ.
n₁
n₂
x̄₁
x̄₂
s₁
s₂
Confidence Level
%
95% Confidence Interval
—
Margin of Error
—
Critical Value
—
Lower Bound
—
Upper Bound
—
Std Error
—
Width
—
📏 Visual Confidence Interval
📊 Compare Confidence Levels (90% / 95% / 99%)
📋 Step-by-Step Solution
📈 Normal Distribution with CI Region
What Is a Confidence Interval?
A confidence interval (CI) is a range of values, computed from sample data, that likely contains the true population parameter. The confidence level (e.g., 95%) tells you how often the method produces intervals that do contain the true value.
CI Formulas
Mean (σ known): CI = x̄ ± z* × (σ/√n) [z-distribution]
Mean (σ unknown): CI = x̄ ± t* × (s/√n) [t-distribution, df=n-1]
Proportion: CI = p̂ ± z* × √(p̂(1-p̂)/n)
Two-sample: CI = (x̄₁-x̄₂) ± z* × √(σ₁²/n₁ + σ₂²/n₂)
Common critical values:
90% CI → z* = 1.645 99% CI → z* = 2.576
95% CI → z* = 1.960 99.9% CI → z* = 3.291
What does "95% confident" actually mean?
It does NOT mean "there is a 95% probability the true value is in this interval." The true value is fixed — it's either in the interval or it isn't. What it means: if you repeated the sampling procedure many times and computed a CI each time, about 95% of those intervals would contain the true value. Any single interval is either correct or incorrect — we just don't know which.
When should I use t instead of z?
Use the t-distribution when: (1) the population standard deviation σ is unknown (you're using sample s instead) AND (2) the sample size n is small (typically n < 30). The t-distribution has heavier tails than z, which accounts for the extra uncertainty from estimating σ. As n increases, t approaches z — for n > 30, the difference becomes negligible and either can be used. The degrees of freedom for the t-distribution is df = n − 1.
How does sample size affect the CI width?
Width = 2 × z* × σ/√n. Increasing n by 4× halves the CI width (because √4 = 2). To make the CI half as wide, you need 4 times as many observations. This quadratic relationship means diminishing returns — going from n=100 to n=400 halves the width, but going from n=400 to n=1600 halves it again. Practical implication: there's an optimal sample size beyond which extra data gives little benefit.
Can a 95% CI contain negative values?
Yes, if the lower bound calculation produces a negative value. For a mean CI, this just means the data includes negative values or the mean is near zero. For a proportion CI, the bounds are constrained to [0,1] — if the formula gives a negative lower bound, it's capped at 0. For two-sample difference CIs, negative values mean the true difference μ₁−μ₂ could be negative (sample 2 could be larger). A two-sample CI that includes 0 means the difference is not statistically significant.
Related Statistics Calculators