DigitHelm

Confidence Interval Calculator | Mean & Proportion

Calculate confidence intervals for means (z and t-test) and proportions (Wald and Wilson). Shows margin of error, critical value, SE, step-by-step working, and a visual bell curve diagram.

Press Enter to calculate · Esc to reset

What Is the Confidence Interval Calculator | Mean & Proportion?

A confidence interval (CI) gives you a range of plausible values for a population parameter, the mean or a proportion, based on sample data. Instead of reporting a single estimate (which is almost certainly not exactly right), a CI says: "we are X% confident the true value lies somewhere in this range."

This calculator supports three modes. Mean, z-test is for large samples (n ≥ 30) or when the population standard deviation σ is known. Mean, t-test uses the t-distribution and is the right choice when n is small or σ must be estimated from the data. Proportion builds intervals for binary outcomes (yes/no, success/failure) and shows both the Wald and Wilson methods.

Formula

Core Confidence Interval Formulas

Mean CI (z-test): x̄ ± zα/2 × σ/√n

Mean CI (t-test): x̄ ± tα/2, n−1 × s/√n

Proportion (Wald): p̂ ± zα/2 × √(p̂(1−p̂)/n)

Proportion (Wilson):

(p̂ + z²/(2n) ± z√(p̂(1−p̂)/n + z²/(4n²))) / (1 + z²/n)

Standard Error (mean): SE = σ/√n  or  s/√n

Standard Error (prop): SE = √(p̂(1−p̂)/n)

SymbolMeaningNotes
Sample meanPoint estimate of population mean μ
σPopulation std devKnown (z-test) or approximated by s
sSample std devEstimated from the sample (t-test)
nSample sizeNumber of observations in the sample
z_{α/2}Normal critical valuee.g. 1.96 for 95%, 2.576 for 99%
t_{α/2,df}t critical valuedf = n − 1; wider than z for small n
Sample proportionObserved successes / n
αSignificance level= 1 − confidence level (e.g. 0.05 for 95%)

COMMON CRITICAL VALUES

Conf. Levelαz criticalt (df=10)t (df=30)t (df=∞)
80%0.201.2821.3721.3101.282
90%0.101.6451.8121.6971.645
95%0.051.9602.2282.0421.960
99%0.012.5763.1692.7502.576

How to Use

  1. 1Select mode: Choose "Mean, z" (large n or known σ), "Mean, t" (small n, unknown σ), or "Proportion" (binary data).
  2. 2Enter values: For means: provide sample mean, standard deviation, and sample size. For proportion: enter the decimal proportion (e.g. 0.45 for 45%) and n.
  3. 3Set confidence level: Click 80%, 85%, 90%, 95%, or 99%. For non-standard levels, use the Custom option.
  4. 4Calculate: Press the button or hit Enter. The interval, margin of error, critical value, and SE are shown instantly.
  5. 5Read the chart: The bell curve highlights the confidence region (shaded) and shows the critical values on both tails.
  6. 6Toggle steps: Tap "Show step-by-step working" to see every calculation written out with the formula applied to your values.

Example Calculation

Example 1, Mean CI (z-test)

Survey of n = 50, x̄ = 74, σ = 12, confidence = 95%.

z₀.₀₂₅ = 1.960

SE = 12 / √50 = 12 / 7.071 = 1.697

ME = 1.960 × 1.697 = 3.327

CI = (74 − 3.327, 74 + 3.327) = (70.673, 77.327)

Interpretation: We are 95% confident the population mean lies between 70.67 and 77.33.

Example 2, Mean CI (t-test)

Small study: n = 12, x̄ = 5.4, s = 1.8, confidence = 95%.

df = 12 − 1 = 11

t₀.₀₂₅,₁₁ = 2.201

SE = 1.8 / √12 = 0.5196

ME = 2.201 × 0.5196 = 1.1437

CI = (5.4 − 1.1437, 5.4 + 1.1437) = (4.256, 6.544)

The t-critical value (2.201) is wider than z (1.960) to reflect added uncertainty from small n.

Example 3, Proportion CI (Wilson)

Poll: 230 out of 500 respondents said yes → p̂ = 0.46, confidence = 95%.

z = 1.960, z² = 3.8416

SE (Wald) = √(0.46 × 0.54 / 500) = 0.02228

Wald CI ≈ (0.4163, 0.5037)

Wilson CI ≈ (0.4166, 0.5050) ← preferred

Wilson corrections are small when n is large and p̂ is not extreme, but matter more near 0 or 1.

Understanding Confidence Interval | Mean & Proportion

Why Confidence Intervals Matter More Than Point Estimates

Reporting "the average is 74" tells only half the story. Reporting "the average is 74, 95% CI (70.7, 77.3)" tells you how certain you are. A study with n = 10 and a study with n = 1,000 might both show a mean of 74, but the confidence intervals will be very different, and that difference is the scientific substance of the finding. Point estimates without intervals are, in the words of statistician Frank Harrell, "the most misused summary statistic in science."

Confidence intervals are now required by most major journals in medicine, psychology, and economics. They communicate effect size and precision simultaneously, enabling readers to judge not just whether an effect exists but whether it is large enough to matter.

Understanding the Three Calculator Modes

ModeWhen to useCritical valueKey assumption
Mean, zn ≥ 30, or σ knownz_{α/2} from normalσ known or CLT applies
Mean, tn < 30, σ unknownt_{α/2, n−1} from t-distData approximately normal
ProportionBinary outcomes (0/1)z_{α/2} from normalnp̂ ≥ 5 and n(1−p̂) ≥ 5

The Central Limit Theorem and Why n Matters So Much

The Central Limit Theorem (CLT) guarantees that for large enough n, the sampling distribution of x̄ is approximately normal regardless of the population shape. "Large enough" is conventionally n ≥ 30, though highly skewed distributions may need n ≥ 50 or more for the approximation to be reliable.

The practical implication: doubling n shrinks the CI width by a factor of √2 (about 29%). Quadrupling n halves the width. This diminishing return is why researchers carefully calculate the required sample size before collecting data, using the Sample Size Calculator to find the minimum n for a target margin of error.

The t-Distribution: Accounting for Unknown σ

When σ is estimated from the data (as sample standard deviation s), there is additional uncertainty. The t-distribution captures this by having heavier tails than the normal distribution. The extra probability in the tails means that for the same confidence level, the t critical value is always larger than z, and therefore the CI is wider.

As degrees of freedom (df = n − 1) grow, the t-distribution converges to standard normal. At df = 30, the 95% t critical value is 2.042 vs. z = 1.960, a modest difference. At df = 10, it is 2.228 vs. 1.960, a meaningful difference that widens the interval noticeably.

Proportion Intervals: Wald vs. Wilson

The Wald interval for a proportion is simple and familiar, but it has a well-documented flaw: its actual coverage probability fluctuates significantly below the nominal level for small n and extreme p̂. For example, with n = 20 and p = 0.05, the 95% Wald interval captures the true p only about 83% of the time, far below 95%.

The Wilson interval adds a small correction that pulls the center toward 0.5 and ensures the interval always stays within [0, 1]. It achieves close to the nominal coverage for almost all combinations of n and p. This calculator always shows both so you can compare, and defaults to Wilson in the primary result.

Effect Size vs. Statistical Significance

A confidence interval communicates something a p-value cannot: the magnitude of the effect. A study with n = 10,000 might find that a drug reduces blood pressure by 2 mmHg with a 95% CI of (1.8, 2.2), statistically highly significant, but clinically meaningless. A smaller study might find a 15 mmHg reduction with a 95% CI of (5, 25), wide uncertainty but a potentially important finding. The CI contains the information needed to make this judgement.

Common Applications by Field

  • Clinical trials: 95% CI for treatment effect (mean difference or relative risk)
  • Polling: 95% CI for voter intent proportions, typically ±3% for n=1,000
  • Manufacturing: CI for process mean to determine if it meets specification
  • A/B testing: CI for conversion rate difference to decide on product changes
  • Economics: CI for GDP growth estimates and unemployment rates
  • Psychology: CI for Cohen's d effect size (now required by APA guidelines)

Interpreting Overlapping Confidence Intervals

A common mistake: concluding that two groups are statistically different when their CIs do not overlap, or that they are not different when they do overlap. Neither rule is correct:

  • Non-overlapping 95% CIs → p < 0.05 for the difference? Usually yes, but not always.
  • Overlapping 95% CIs → p ≥ 0.05? Not necessarily, overlapping CIs are compatible with p < 0.05.
  • To properly test for a difference, compute a CI for the difference itself (or run a proper two-sample test).

Frequently Asked Questions

What does a 95% confidence interval actually mean?

The 95% refers to the long-run procedure, not the specific interval in front of you. Here is a precise interpretation:

  • If you repeated the same study 100 times, each time computing a 95% CI, roughly 95 of those intervals would capture the true population parameter.
  • It does NOT mean there is a 95% chance the true parameter is inside your specific interval, the true value either is in there or it isn't.
  • Think of it as a measure of the method's reliability, not a probability statement about one interval.

Higher confidence (99%) gives wider intervals. Lower confidence (90%) gives narrower ones. Neither is always "better", it depends on the cost of being wrong vs. the cost of imprecision.

When should I use the z-test vs the t-test?

The choice depends on what you know about the population and how large your sample is:

  • Use z when n ≥ 30 (Central Limit Theorem guarantees near-normal sampling distribution) or when the population standard deviation σ is known exactly.
  • Use t when n < 30 and you are estimating σ from the sample. The t-distribution has heavier tails to account for the extra uncertainty.
  • When df (= n − 1) is large (say, df > 100), the t-distribution is nearly identical to z. The difference becomes negligible.
  • When in doubt with a small sample, use t, it is more conservative and will give a slightly wider, more honest interval.

What is the margin of error and how do I reduce it?

The margin of error (ME = critical value × SE) determines how wide the interval is. To reduce it:

  • Increase sample size n, the most effective lever. Halving ME requires quadrupling n.
  • Lower the confidence level, switching from 99% to 95% reduces the critical value from 2.576 to 1.960.
  • Reduce variability, better measurement instruments, more homogeneous populations, or matched-pair designs all reduce σ or s.

The relationship is: ME ∝ 1/√n. So going from n=100 to n=400 halves the margin of error.

What is the Wilson interval and why is it better than Wald for proportions?

The Wald interval (p̂ ± z × SE) has two well-known problems:

  • It can produce bounds outside [0, 1] when p̂ is near 0 or 1.
  • Its coverage probability (the actual % of intervals that capture the true p) oscillates below the nominal level for small n.
  • It gives zero-width intervals when p̂ = 0 or p̂ = 1.

The Wilson interval (also called the score interval) shifts the centre slightly toward 0.5 and widens symmetrically. It has much better coverage properties, especially for small samples or extreme proportions. It is recommended by the American Statistical Association for routine use.

How is a confidence interval related to hypothesis testing?

There is a direct duality between CIs and two-sided hypothesis tests:

  • A 95% CI contains exactly the set of null hypothesis values that would NOT be rejected at the 5% significance level.
  • If the value μ₀ (or p₀) lies outside your CI, you can reject H₀: μ = μ₀ at the α = 1 − (conf/100) level.
  • A CI gives more information than a simple reject/fail-to-reject decision, it tells you the plausible magnitude of the effect.

This duality means you can use a CI as a significance test without separately computing a p-value.

Can I use this calculator for a one-sided confidence bound?

This calculator computes two-sided intervals. To get a one-sided bound, adjust the confidence level:

  • For a one-sided 95% upper bound, use a two-sided 90% CI, the upper limit of the 90% CI equals the one-sided 95% upper bound.
  • For a one-sided 99% lower bound, use a two-sided 98% CI, the lower limit equals the one-sided 99% lower bound.
  • The critical z for one-sided α = 0.05 is 1.645, which equals the two-sided 90% critical value.

What sample size do I need for a given margin of error?

Rearranging ME = z × σ/√n gives the required sample size for a mean CI:

n = (z × σ / ME)²

For a proportion CI, use σ = √(p̂(1−p̂)). With unknown p̂, use p̂ = 0.5 (worst case) giving:

n = (z / (2 × ME))²

For more detail and presets, use the Sample Size Calculator.

Does a wider interval mean a better or worse estimate?

Width reflects precision, not quality:

  • A narrow interval means you have a precise estimate, small variability or large sample.
  • A wide interval means high uncertainty, large variability or small sample.
  • A narrow interval at 80% confidence is not "better" than a wide one at 99% if the situation demands high certainty.

The goal is an interval that is narrow enough to be useful AND wide enough (high confidence) to be credible. The right trade-off depends on the decision at stake, medical trials typically demand 95–99%, while preliminary research may accept 90%.

Related Calculators