Confidence Interval Calculator
Build a confidence interval for a mean (z or t), a proportion, or straight from a raw data list — with a shaded normal/t-curve diagram, an interval visual, and full step-by-step working.
Background
A confidence interval gives a range of plausible values for a population parameter based on sample data. A larger sample size narrows the interval; a higher confidence level widens it — because reaching a higher confidence requires a larger critical value, and a larger critical value means more margin of error.
🔎 Looking for how large a sample you need to collect, rather than the interval from a sample you already have? That's a related but different calculation — see our Sample Size Calculator.
How to use this calculator
- Choose Mean, σ known only if the population standard deviation is explicitly given — otherwise use Mean, σ unknown, which uses a t-interval instead.
- Choose Proportion to enter either a sample proportion directly, or successes and trials to have it computed for you.
- Choose Raw Data to paste a full dataset — the calculator computes n, the mean, and the sample standard deviation automatically.
- Click Calculate to see the interval, a shaded critical-region diagram, an interval visual, and full step-by-step working.
How confidence intervals work
Every confidence interval has the same shape: estimate ± (critical value) × (standard error).
A higher confidence level pushes the critical value further into the tails of the distribution, which widens the margin of error.
Use a z-critical value when the population standard deviation is known; use a t-critical value (which depends on degrees of freedom) when it's estimated from the sample.
As degrees of freedom increase, the t-distribution gets closer to the normal distribution — which is why the t-table's last row is essentially the z-value.
"95% confidence" describes the method, not this one interval — it means that if you repeated the sampling many times, about 95% of the resulting intervals would contain the true population value.
Formula & Equations Used
Mean, σ known: x̄ ± z* · (σ/√n)
Mean, σ unknown: x̄ ± t* · (s/√n), with df = n − 1
Proportion: p̂ ± z* · √(p̂(1−p̂)/n)
Sample standard deviation: s = √(Σ(x−x̄)² / (n−1))
Example Problems & Step-by-Step Solutions
These cover cases the Quick Examples chips above don't already demonstrate.
Example 1 — Mean, σ known
A sample of n=49 has x̄=64, drawn from a population with known σ=8. Build a 90% CI.
Step: z* ≈ 1.645. SE = 8/√49 = 1.143. ME = 1.645 × 1.143 = 1.880.
Result: 90% CI = (62.12, 65.88).
Example 2 — Mean, σ unknown
A sample of n=20 has x̄=50, s=6. Build a 95% CI (σ unknown, so this needs a t-interval).
Step: df=19, t* ≈ 2.093. SE = 6/√20 = 1.342. ME = 2.093 × 1.342 = 2.808.
Result: 95% CI = (47.19, 52.81).
Example 3 — Proportion
A poll of 150 people finds p̂=0.65 support a measure. Build a 98% CI.
Step: Check n·p̂=97.5 and n·(1−p̂)=52.5 — both ≥10, so the interval is reliable. z*≈2.326, SE=0.039, ME=0.091.
Result: 98% CI = (0.559, 0.741).
Example 4 — Raw data
Build a 95% CI for the mean from the dataset 12, 15, 11, 18, 20, 14.
Step: n=6, x̄=15, s≈3.464, df=5, t*≈2.571. SE=1.414, ME=3.636.
Result: 95% CI = (11.36, 18.64).
Frequently Asked Questions
Why does a 99% CI look wider than a 95% CI?
Because higher confidence requires a larger critical value, and a larger critical value directly increases the margin of error — there's no way to get more confidence without paying for it in interval width, unless you also increase the sample size.
When do I use a t-interval instead of a z-interval?
Use a t-interval for a mean whenever the population standard deviation is unknown and you're using the sample standard deviation as an estimate — which describes the vast majority of real studies.
Does a 95% CI mean there's a 95% chance the true value is in this specific interval?
Not quite. It means the method used would capture the true population value in about 95% of intervals built this way across many repeated samples — this specific interval either contains the true value or it doesn't.
I need the sample size for my study, not a confidence interval — is this the right tool?
Not quite — this calculator builds an interval from a sample you already have. To find how large a sample to collect for a target margin of error, use our Sample Size Calculator instead, which rearranges the same formulas to solve for n.