📚 Deep explanation
What is a confidence interval?
A confidence interval (CI) is a range of values you compute from a sample that is intended to
capture an unknown population parameter, such as a true mean (μ) or a true proportion (p). It is one of the
most practical ideas in statistics because it turns a single “best guess” into a range that reflects real-world
uncertainty. When people say “statistics is about uncertainty,” confidence intervals are a big part of what they mean.
Here’s the intuition: if you sample 36 people and measure their sleep hours, your sample mean won’t equal the true
population mean perfectly. It will be close, but it will wiggle around depending on who you happened to sample.
A confidence interval builds a buffer around your estimate based on how much wiggle you expect. That buffer is the
margin of error.
Most confidence intervals have the same basic shape:
estimate ± (critical value) × (standard error).
The estimate is something like x̄ (sample mean) or p̂ (sample proportion). The standard error is the typical
size of sampling fluctuations. The critical value is how “wide” you want your safety net to be. A 99% interval is
wider than a 95% interval because it aims to catch the true value more often.
The 3 steps (works for almost every CI)
- 1) Pick a confidence level: common choices are 90%, 95%, 98%, or 99%.
- 2) Compute the standard error: it depends on what you’re estimating (mean vs proportion).
- 3) Multiply by the critical value: margin of error = critical × SE, then build the interval.
Why does the confidence level change the width?
Imagine throwing a net to catch a moving fish. If you want to catch the fish more often, you make the net bigger.
In CIs, “bigger net” means a larger critical value. For a normal curve, about 95% of values are within 1.96 standard
deviations of the mean, but about 99% are within 2.576 standard deviations. That extra width is the price you pay
for higher confidence.
Confidence vs probability (the honest wording)
The true mean (μ) is not random in classical statistics—it’s a fixed number you don’t know. The interval is random
because your sample is random. So we don’t say “95% chance μ is in this specific interval.” We say:
“Using this method, 95% of intervals built from repeated samples would contain μ.” In everyday speech, many people
still say the first version. If you’re writing for a stats class or a paper, use the second.
🧮 Formula breakdown
Formulas this calculator uses
This page supports three common confidence intervals. Pick the one that matches your situation.
(If you’re unsure: for a mean, use the t-interval when σ is unknown; for a proportion, use the z-interval.)
A) Mean, σ known → z interval
- Estimate: x̄
- Standard error: SE = σ / √n
- Critical value: z* (depends on confidence level)
- Margin of error: ME = z* × σ / √n
- CI: x̄ ± ME
B) Mean, σ unknown → t interval
- Estimate: x̄
- Standard error: SE = s / √n
- Degrees of freedom: df = n − 1
- Critical value: t* (depends on df and confidence level)
- Margin of error: ME = t* × s / √n
- CI: x̄ ± ME
C) Proportion → z interval
- Estimate: p̂ = x / n (successes divided by sample size)
- Standard error: SE = √( p̂(1 − p̂) / n )
- Critical value: z*
- Margin of error: ME = z* × √( p̂(1 − p̂) / n )
- CI: p̂ ± ME (often reported as a percentage)
What are z* and t*?
The “*” just means “critical.” For z*, we use the standard normal distribution. For t*, we use Student’s t distribution,
which is a bit wider (heavier tails) when sample sizes are small. As n grows, t* approaches z*. That’s why big samples
make the mean interval narrower even if your confidence level stays the same: your SE shrinks because √n grows.