Home/Statistics/Confidence Interval Calculator

Confidence Interval Calculator

Calculate a confidence interval for a population mean (z-test or t-test) or a population proportion, with margin of error, critical values, and the full working shown.

Quick Answer: How Do You Calculate a Confidence Interval?

Take your sample statistic (a mean or a proportion), then add and subtract a margin of error: CI = estimate ± (critical value × standard error). The critical value comes from the z-distribution for large samples or known population standard deviation, or the t-distribution for small samples with an unknown population standard deviation. A wider interval means more confidence but less precision — a 99% confidence interval is always wider than a 95% one calculated from the same data.

Confidence Interval for Mean
Sample Mean (x̄)
Std Deviation
σ or s value
Sample Size (n)
Confidence Level
CI for Proportion

E.g. survey: 180 of 300 respondents said "Yes"

Successes (x)
Sample Size (n)
Confidence Level
Confidence Interval Result
95% Confidence Interval
(72.73, 78.27)
Margin of error: ±2.77
ParameterValue
Multiple Confidence Levels Comparison
LevelLowerUpperWidth

What Is a Confidence Interval?

A confidence interval is a range of values, built from sample data, that is likely to contain the true value of a population parameter — a mean, a proportion, or another statistic. Rather than reporting a single number as if it were exact, a confidence interval honestly communicates the uncertainty that comes from working with a sample instead of the entire population.

A 95% confidence interval is the most common choice, but the precise meaning trips people up constantly. It does not mean there is a 95% probability the true value lies in this specific interval — either it does or it doesn't. It means that if you repeated the same sampling procedure many times and built a confidence interval each time, approximately 95% of those intervals would contain the true population value. The 95% describes the reliability of the method, not the probability attached to one particular result.

💡 Did You Know? The confidence interval was introduced by Polish mathematician Jerzy Neyman in 1937, as a way to quantify estimation uncertainty without needing to assume a probability distribution for the unknown parameter itself — a subtly different idea from Bayesian credible intervals, which are often confused with confidence intervals but answer a genuinely different question.

Confidence Interval Formula

For a mean (z, large sample or known σ):   CI = x̄ ± z* × (σ / √n)
For a mean (t, small sample, s unknown σ):   CI = x̄ ± t* × (s / √n)
For a proportion:   CI = p̂ ± z* × √(p̂(1−p̂) / n)
x̄ = sample mean | p̂ = sample proportion | z*/t* = critical value | n = sample size

Z-Test vs T-Test: Which Critical Value to Use

SituationUseWhy
Population SD (σ) knownz-distributionNo extra uncertainty from estimating σ
Population SD unknown, n ≥ 30z-distribution (common approximation)The Central Limit Theorem makes the sampling distribution close to normal, and the t-distribution converges to z at large n
Population SD unknown, n < 30t-distribution, df = n − 1Heavier tails account for the extra uncertainty of estimating σ from a small sample
Proportionsz-distributionThe standard formula for proportion intervals uses the normal approximation

Common Critical Values

Confidence Levelαz* (large sample)t* (n=25, df=24)
90%0.101.6451.711
95%0.051.9602.064
99%0.012.5762.797

Step-by-Step Calculation Examples

Example 1 — confidence interval for a mean (z, large sample)

A sample of n = 36 items has mean x̄ = 100 and known population SD σ = 15. Find the 95% CI.
Standard error: SE = σ/√n = 15/√36 = 2.5
Margin of error: E = 1.96 × 2.5 = 4.9
95% CI = 100 ± 4.9 = (95.10, 104.90)

Example 2 — confidence interval for a mean (t, small sample)

A sample of n = 12 items has mean x̄ = 48 and sample SD s = 8. Population SD is unknown, so use t with df = 11.
Standard error: SE = s/√n = 8/√12 ≈ 2.3094
Critical value: t* ≈ 2.201 (95%, df=11)
Margin of error: E = 2.201 × 2.3094 ≈ 5.084
95% CI ≈ (42.92, 53.08) — noticeably wider than a z-based interval, reflecting the extra uncertainty of a small sample

Example 3 — Australian opinion poll (proportion)

A poll of 1,000 Australians finds 54% support a policy. Find the 95% CI.
p̂ = 0.54; SE = √(0.54 × 0.46 / 1000) ≈ 0.01575
Margin of error: E = 1.96 × 0.01575 ≈ 0.0309 (about ±3.1 percentage points)
95% CI = 0.54 ± 0.031 = (51%, 57%)

Example 4 — effect of confidence level on width

Using the same data as Example 1 (x̄ = 100, σ = 15, n = 36):
90% CI: E = 1.645 × 2.5 = 4.11 → (95.89, 104.11)
95% CI: E = 1.96 × 2.5 = 4.9 → (95.10, 104.90)
99% CI: E = 2.576 × 2.5 = 6.44 → (93.56, 106.44)
Higher confidence always produces a wider interval from the same data — you cannot get more confidence and more precision for free.

Margin of Error and Sample Size

The margin of error is the "±" part of a confidence interval: E = critical value × standard error. Because the standard error shrinks with the square root of the sample size, the relationship between precision and sample size is not linear — quadrupling the sample size only halves the margin of error. This is exactly why very precise surveys (say, ±1%) require thousands of respondents, while a rough estimate (±5%) can be achieved with only a few hundred.

This page doubles as a standard error calculator: the "Std error (SE)" row in the results table above is calculated the moment you enter your mean, standard deviation and sample size — SE = σ/√n (or s/√n for a sample), with no separate tool needed.

Common Mistakes

MistakeWhy it goes wrongHow to avoid it
Saying "there's a 95% chance the true value is in this interval"The true value either is or isn't in a specific interval — the 95% describes the method's long-run reliability, not this one resultSay "we are 95% confident" or describe the repeated-sampling interpretation
Using z when the sample is small and σ is unknownUnderstates the true uncertainty, making the interval falsely narrowUse the t-distribution with n − 1 degrees of freedom for small samples
Assuming a narrower interval is always "better"A narrow interval built with low confidence is less trustworthy, not more precise for freeReport both the confidence level and the interval width together
Confusing a confidence interval with a prediction intervalA confidence interval estimates a population parameter; a prediction interval estimates where a single new observation will fall, and is always widerBe clear about which one the question is actually asking for
Ignoring non-sampling errorA confidence interval only accounts for random sampling variability, not bias from a flawed survey design or non-responseTreat the margin of error as a floor on total uncertainty, not the whole picture
⚠️ Common Mistake: Reporting "51% support, margin of error ±3%" and then treating 48% and 54% as equally supported. The interval is centred and symmetric — values near the middle of the range are more consistent with the data than values near the edges, even though the interval itself doesn't rank them.

Practical Applications

Survey and market research

Every published poll or survey result should be accompanied by a confidence interval or margin of error. The Australian Bureau of Statistics publishes confidence intervals alongside its Labour Force Survey estimates, and reputable opinion polling always reports a margin of error alongside the headline number.

Clinical research

Medical and health research reports treatment effects with confidence intervals rather than single numbers, since the NHMRC and equivalent international bodies expect confidence intervals in published clinical research to communicate how precisely an effect has been estimated.

Quality control and manufacturing

Confidence intervals around a process mean or defect rate help decide whether a manufacturing process is meeting specification, distinguishing genuine drift from ordinary sampling variability.

Business and A/B testing

Confidence intervals around conversion rates or average order values tell a business whether an observed difference between two versions of a website or product is likely to be real, or plausibly just noise from a limited sample.

How to Calculate a Confidence Interval in Excel

Excel and Google Sheets don't build the full interval for you — they return the margin of error, which you then add and subtract from the mean yourself. There are two functions, matching the z-test/t-test choice explained above.

=CONFIDENCE.NORM(alpha, standard_dev, size)   — margin of error using z (large sample or known σ)
=CONFIDENCE.T(alpha, standard_dev, size)   — margin of error using t (small sample, unknown σ)
=AVERAGE(range) − CONFIDENCE.NORM(...)   and   =AVERAGE(range) + CONFIDENCE.NORM(...)

Worked example in Excel

Same data as Example 1 above: mean 100, σ = 15, n = 36, 95% confidence → alpha = 0.05.
=CONFIDENCE.NORM(0.05, 15, 36) returns 4.90 — the margin of error, matching the calculator above.
Lower bound: =100-4.9 → 95.10. Upper bound: =100+4.9 → 104.90.
If you only have raw sample data in a range, replace the mean and σ with =AVERAGE(range) and =STDEV.S(range), and use =CONFIDENCE.T(...) instead if the sample is small and σ is unknown.

Older versions of Excel only have =CONFIDENCE(alpha, standard_dev, size), which is equivalent to CONFIDENCE.NORM. Google Sheets supports the same CONFIDENCE.NORM and CONFIDENCE.T functions.

How to Find a Confidence Interval on a TI-84 Calculator

The TI-84 builds the whole interval for you, including the correct critical value, directly from the STAT → TESTS menu.

For a mean, known σ (ZInterval)

Press STAT → arrow right to TESTS → scroll down to 7:ZInterval
Choose Stats if you already have x̄, σ and n (or Data to pull from a list), enter the values, and set your C-Level (e.g. 0.95)
Select Calculate — the calculator returns the interval directly, e.g. (95.10, 104.90)

For a mean, unknown σ (TInterval)

Press STATTESTS8:TInterval
Enter x̄, Sx (sample SD) and n, or point it at a data list, then set the confidence level and select Calculate
The TI-84 automatically uses the t-distribution with df = n − 1, exactly like the "sample (s, use t)" option in the calculator above

For a proportion (1-PropZInt)

Press STATTESTS → scroll to A:1-PropZInt
Enter x (number of successes) and n (sample size), set the confidence level, and select Calculate
This matches the "CI for Proportion" card on this page — both use z = 1.96 for 95% confidence

Confidence Interval Cheat Sheet

Quick Reference

Mean (z): CI = x̄ ± z* × (σ/√n)
Mean (t): CI = x̄ ± t* × (s/√n), df = n − 1
Proportion: CI = p̂ ± z* × √(p̂(1−p̂)/n)
90% critical value: z* = 1.645  |  95%: 1.960  |  99%: 2.576
Margin of error: E = critical value × standard error
Rule of thumb: quadruple n to halve the margin of error
Excel: =CONFIDENCE.NORM(alpha, sd, n), =CONFIDENCE.T(alpha, sd, n)

Practice Questions

Beginner (with answers)

  1. A sample of n = 64 has mean 50 and known σ = 8. Find the standard error.
  2. Using Q1, find the 95% margin of error.
  3. State the 95% confidence interval from Q1–2.
  4. Does a 99% CI end up wider or narrower than a 95% CI from the same data?
  5. A poll of 400 people finds 60% support a proposal. Find the standard error of the proportion.
Show answers

1) SE = 8/√64 = 1.0   2) E = 1.96×1.0 = 1.96   3) (48.04, 51.96)   4) Wider — higher confidence needs a larger critical value   5) SE = √(0.6×0.4/400) = 0.0245

Advanced (with answers)

  1. A sample of n = 16 has mean 40 and sample SD s = 6 (population SD unknown). Find the 95% CI using t* ≈ 2.131 (df=15).
  2. How much would the margin of error in Q1 shrink if n were quadrupled to 64 (assuming s stays the same, using z* ≈ 1.96 as an approximation for the larger sample)?
  3. A survey of 1,200 people finds 45% approval. Find the 99% CI (z* = 2.576).
  4. Explain why a 90% CI is narrower than a 95% CI from identical data.
  5. A CI for a mean is reported as (18.2, 25.8). What are the point estimate and margin of error?
Show answers

1) SE = 6/√16 = 1.5, E = 2.131×1.5 ≈ 3.197, CI ≈ (36.80, 43.20)   2) New SE = 6/√64 = 0.75, E ≈ 1.96×0.75 ≈ 1.47 — roughly half the original margin of error   3) SE = √(0.45×0.55/1200) ≈ 0.01436, E = 2.576×0.01436 ≈ 0.0370, CI ≈ (41.3%, 48.7%)   4) A 90% CI uses a smaller critical value because it accepts a higher chance of missing the true value in exchange for a tighter range   5) Point estimate = midpoint = (18.2+25.8)/2 = 22.0; margin of error = half the width = (25.8−18.2)/2 = 3.8

🔑 Key Takeaways

  • A 95% CI means: if the sampling procedure were repeated many times, about 95% of the resulting intervals would contain the true parameter.
  • CI = point estimate ± (critical value × standard error).
  • Standard error shrinks as sample size grows, but only by the square root — quadrupling n halves the margin of error.
  • Use the t-distribution for small samples (n < 30) with unknown population SD; use z otherwise.
  • Higher confidence always means a wider interval from the same data — precision and confidence trade off against each other.
  • A confidence interval only captures sampling error, not bias from a flawed study design.

Frequently Asked Questions

References

Last updated: August 2026
Reviewed by Mohsin Iqbal using standard statistical definitions, with every worked example independently verified. This page is for educational purposes.