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
Custom level
(0–1)
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
Parameter
Value
Multiple Confidence Levels Comparison
Level
Lower
Upper
Width
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
Situation
Use
Why
Population SD (σ) known
z-distribution
No extra uncertainty from estimating σ
Population SD unknown, n ≥ 30
z-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 < 30
t-distribution, df = n − 1
Heavier tails account for the extra uncertainty of estimating σ from a small sample
Proportions
z-distribution
The standard formula for proportion intervals uses the normal approximation
Common Critical Values
Confidence Level
α
z* (large sample)
t* (n=25, df=24)
90%
0.10
1.645
1.711
95%
0.05
1.960
2.064
99%
0.01
2.576
2.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
Mistake
Why it goes wrong
How 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 result
Say "we are 95% confident" or describe the repeated-sampling interpretation
Using z when the sample is small and σ is unknown
Understates the true uncertainty, making the interval falsely narrow
Use 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 free
Report both the confidence level and the interval width together
Confusing a confidence interval with a prediction interval
A confidence interval estimates a population parameter; a prediction interval estimates where a single new observation will fall, and is always wider
Be clear about which one the question is actually asking for
Ignoring non-sampling error
A confidence interval only accounts for random sampling variability, not bias from a flawed survey design or non-response
Treat 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.
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 STAT → TESTS → 8: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 STAT → TESTS → 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)
A sample of n = 64 has mean 50 and known σ = 8. Find the standard error.
Using Q1, find the 95% margin of error.
State the 95% confidence interval from Q1–2.
Does a 99% CI end up wider or narrower than a 95% CI from the same data?
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)
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).
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)?
A survey of 1,200 people finds 45% approval. Find the 99% CI (z* = 2.576).
Explain why a 90% CI is narrower than a 95% CI from identical data.
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
A 95% CI means that if you repeated the study many times and calculated a confidence interval each time, approximately 95% of those intervals would contain the true population parameter. It does not mean there is a 95% chance the true value is in this particular interval — either it is or it isn't. The 95% describes the reliability of the method, not a probability attached to a single result.
Find your sample statistic (mean or proportion), calculate its standard error, multiply the standard error by the appropriate critical value to get the margin of error, then add and subtract that margin from the statistic. For a mean: CI = x̄ ± z* × (σ/√n) or CI = x̄ ± t* × (s/√n) for small samples with unknown population SD.
Use the t-distribution when the sample size is small (typically n < 30) and the population standard deviation is unknown, so you're estimating it from the sample. The t-distribution has heavier tails to account for that extra uncertainty. Use z when the population SD is known, or the sample is large enough (n ≥ 30) that the t-distribution has converged close to normal.
Use CI = p̂ ± z* × √(p̂(1−p̂)/n), where p̂ is the sample proportion (successes divided by sample size) and z* is the critical value for your chosen confidence level. For example, with 180 successes out of 300 (p̂ = 0.6) at 95% confidence, the margin of error is 1.96 × √(0.6×0.4/300) ≈ 0.0555, giving a CI of roughly (54.5%, 65.5%).
Three ways: increase the sample size (standard error shrinks with the square root of n, so quadrupling n halves the margin of error); lower the confidence level (a 90% interval is narrower than a 95% one, but you're accepting more risk of missing the true value); or reduce the underlying variability of the data, which is often not controllable. In survey research, doubling precision requires roughly quadrupling the sample size.
The margin of error is the "±" amount — half the width of the confidence interval. The confidence interval itself is the full range: point estimate minus the margin of error, to point estimate plus the margin of error. A poll reported as "54% ± 3%" has a margin of error of 3 percentage points and a confidence interval of (51%, 57%).
To be more confident that an interval captures the true value, the interval has to cover more of the possible range — a 99% interval is deliberately wider than a 95% interval from identical data, using a larger critical value (2.576 versus 1.960). There is no way to increase confidence and precision simultaneously without collecting more data.
It depends on the desired margin of error, the variability of the data, and the confidence level. Because standard error scales with 1/√n, halving the margin of error requires roughly quadrupling the sample size. The sample size calculator works this calculation backwards, taking a target margin of error and returning the required n.
Yes. A two-sided interval (the standard case, and what this calculator produces) bounds the parameter both above and below. A one-sided interval only bounds it in one direction — for example, "we are 95% confident the true mean is at least X" — and uses a different critical value than the two-sided version at the same overall confidence level.
Yes. Enter a sample mean (or successes and sample size for a proportion), the standard deviation, sample size and confidence level, and the calculator shows the standard error, critical value, margin of error, and the resulting interval — plus a side-by-side comparison across 90%, 95% and 99% confidence for the same data.
Use =CONFIDENCE.NORM(alpha, standard_dev, size) for a z-based interval, or =CONFIDENCE.T(alpha, standard_dev, size) for a t-based interval with small samples. Both return the margin of error only — add and subtract the result from =AVERAGE(range) yourself to get the full interval. Older Excel versions use =CONFIDENCE(...), equivalent to CONFIDENCE.NORM.
Press STAT, arrow to TESTS, then choose 7:ZInterval (mean, known σ), 8:TInterval (mean, unknown σ, small sample) or A:1-PropZInt (proportion). Enter your statistics or point it at a data list, set the confidence level, and select Calculate — the TI-84 returns the full interval directly.
Yes. The standard error (SE = σ/√n, or s/√n for a sample) is calculated automatically and shown in the results table as soon as you enter your mean, standard deviation and sample size — you don't need a separate tool.
Last updated: August 2026
Reviewed by Mohsin Iqbal using standard statistical definitions, with every worked example independently verified. This page is for educational purposes.