📊Confidence Interval Calculator

Calculate confidence intervals for a population mean using the Z-distribution (known σ) or T-distribution (unknown σ). Supports 80%–99.9% confidence levels. Returns margin of error, lower/upper bounds, and critical values.

Prefer to skip the form? Scroll down and Ask AI Instead. Just describe your situation and let AI handle the math for you in seconds.

Margin of Error (Z)

1

Z-Interval (σ known)(19.713, 21.487)
Margin of Error — Z1
Z* Critical Value2
T-Interval (σ estimated)(19.6906, 21.5094)
Margin of Error — T1
T* Critical Value2
Standard Error (σ/√n)0
Degrees of Freedom (n − 1)49
Sample Mean (x̄)21
Standard Deviation3
Sample Size (n)50
Confidence Level (%)95

Z-Interval vs T-Interval Width Comparison

✦ Ask AI Instead

Confidence Interval Calculator: Z and T Intervals Explained

A confidence interval (CI) is a range of values, derived from sample data, that is likely to contain the true population parameter with a specified probability (the confidence level). A 95% CI means that if the experiment were repeated 100 times, approximately 95 of the resulting intervals would contain the true mean.

Formulas: Z-interval: x̄ ± z* × (σ/√n) | T-interval: x̄ ± t* × (s/√n)

Confidence LevelZ* Critical ValueWidth (SE=1)
90%1.6453.29
95%1.9603.92
99%2.5765.15

Our confidence interval calculator computes both the Z-interval (treating the standard deviation as the true population σ) and the T-interval (treating it as an estimated sample standard deviation s), so you can see how the two methods compare for your specific sample size.

Z-Interval vs T-Interval: When to Use Each

The key difference between Z and T intervals lies in what you know about the population. The Z-interval uses the standard normal distribution and assumes σ is the known population standard deviation. In practice, σ is rarely known, which is why the T-interval is more commonly used: it uses the t-distribution with n−1 degrees of freedom, which has heavier tails than the normal to account for the additional uncertainty in estimating σ from the sample.

As sample size increases, the t-distribution converges to the standard normal, and the two intervals become nearly identical. For n ≥ 30, the difference is typically negligible for practical purposes. For small samples (n < 15), the T-interval can be substantially wider — correctly reflecting higher uncertainty. The general rule: if σ is truly known (e.g., from historical data or process control), use Z; otherwise, use T.

How Margin of Error Works

The margin of error (ME) is the half-width of the confidence interval: ME = z* × SE, where the standard error SE = σ/√n. Three factors control ME: the confidence level (higher confidence → larger z* → wider interval), the standard deviation (more variable population → wider interval), and the sample size (larger n → smaller SE → narrower interval).

To halve the margin of error, you must quadruple the sample size — because SE = σ/√n, halving SE requires multiplying n by 4. This relationship is fundamental for survey and experiment design: if a poll reports a ±3% margin of error at 95% confidence, using n ≈ 1,068 respondents, getting ±1.5% would require roughly 4,272 respondents.

Interpreting a Confidence Interval Correctly

A common misinterpretation: "there is a 95% probability that the true mean lies in this interval." This is incorrect — after the interval is computed, the true mean either is or isn't in it. The correct interpretation: the procedure used to generate this interval will produce intervals that capture the true mean 95% of the time. The probability statement applies to the procedure, not to the specific interval. This frequentist interpretation is subtle but important: it means CI width reflects sampling variability, not personal uncertainty about the parameter.

Frequently Asked Questions

What is a 95% confidence interval?

A 95% confidence interval is a range computed from sample data such that, if the same procedure were repeated many times, 95% of the resulting intervals would contain the true population mean. It does not mean there is a 95% probability that the true mean falls in this specific interval — once computed, the true mean either is or isn't in the interval. The 95% refers to the long-run performance of the estimation procedure. For a sample mean of 20.6, SD of 3.2, and n=50: SE = 3.2/√50 ≈ 0.4525; ME = 1.96 × 0.4525 ≈ 0.887; CI = (19.713, 21.487).

When should I use a Z-interval instead of a T-interval?

Use the Z-interval when you know the true population standard deviation σ (rare in practice) or when the sample is large enough (n ≥ 30) that the difference is negligible. Use the T-interval when the standard deviation is estimated from the sample (the usual case), especially for small samples. The T-interval uses the t-distribution with n−1 degrees of freedom, which has heavier tails than the normal to account for the additional uncertainty in estimating σ. As n → ∞, the T-interval converges to the Z-interval.

How do I reduce my margin of error?

The margin of error ME = z* × σ/√n, so you can reduce it by: (1) Increasing sample size n — quadrupling n halves ME. (2) Reducing standard deviation σ — achieved by using more precise measurement instruments or reducing population variability through stratification. (3) Lowering your confidence level — a 90% CI is narrower than a 99% CI, but you accept a higher chance the interval misses the true mean. In practice, increasing n is the most common approach for reducing margin of error in surveys and experiments.

What is standard error and how is it different from standard deviation?

Standard deviation (σ or s) measures variability within the population or sample — how spread out individual observations are. Standard error (SE = σ/√n) measures variability of the sample mean across repeated samples — how precisely the sample mean estimates the population mean. As n increases, SE decreases proportionally to 1/√n: doubling n reduces SE by a factor of √2 ≈ 1.41. The confidence interval uses SE (not SD) as its half-width multiplier because we are making an inference about the mean, not about individual observations.

What does degrees of freedom mean for the T-interval?

Degrees of freedom (df = n − 1) reflects the amount of information available to estimate variability. With n data points and one parameter already estimated (the mean), only n−1 values are free to vary independently. Fewer degrees of freedom mean a wider t-distribution (heavier tails), which produces larger critical values and therefore wider intervals. For df=5, t* at 95% is 2.571 vs z*=1.960 — a 31% wider interval. For df=100, t*=1.984 vs z*=1.960 — essentially the same. The t-distribution was developed by William Sealy Gosset (who published under the pseudonym "Student") in 1908 specifically to handle small samples with estimated variance.