Confidence Interval Calculator
Calculate a confidence interval for a mean, a proportion, or directly from raw data. This calculator supports z-intervals and t-intervals, shows the margin of error, gives a clear step-by-step solution, and includes a small confidence interval visual.
Background
A confidence interval gives a range of plausible values for a population parameter based on sample data. In general, a larger sample size makes the interval narrower, while a higher confidence level makes it wider. For means, the calculator uses either a z critical value or a t critical value depending on what information is available.
How to use this calculator
- Choose the correct mode: mean with known σ, mean with unknown σ, proportion, or raw data.
- Enter the sample information and select a confidence level.
- Click Calculate to see the interval, margin of error, method used, and optional step-by-step solution.
- In proportion mode, you can enter either p̂ directly or successes and trials.
How this calculator works
- Mean (population SD known): uses x̄ ± z*·(σ/√n).
- Mean (population SD unknown): uses x̄ ± t*·(s/√n) with df = n−1.
- Proportion: uses p̂ ± z*·√(p̂(1−p̂)/n).
- Raw data mode: computes x̄, s, and n, then builds a t-interval.
- The margin of error is the critical value times the standard error.
- A higher confidence level makes the interval wider, while a larger sample size usually makes it narrower.
Formula & Equations Used
Mean CI with known σ: x̄ ± z*·(σ/√n)
Mean CI with unknown σ: x̄ ± t*·(s/√n)
Proportion CI: p̂ ± z*·√(p̂(1−p̂)/n)
Sample mean: x̄ = (Σx) / n
Sample standard deviation: s = √(Σ(x − x̄)² / (n − 1))
Margin of error: ME = critical value × SE
Example Problem & Step-by-Step Solution
Example 1 — Mean CI with known population SD
Suppose x̄ = 72, σ = 12, n = 36, and the confidence level is 95%.
- Use x̄ ± z*·(σ/√n).
- For 95%, z* ≈ 1.96.
- SE = 12/√36 = 12/6 = 2.
- ME = 1.96·2 = 3.92.
- CI = 72 ± 3.92 = (68.08, 75.92).
Example 2 — Proportion CI
A survey finds p̂ = 0.42 from n = 200 at 95% confidence.
- Use p̂ ± z*·√(p̂(1−p̂)/n).
- For 95%, z* ≈ 1.96.
- Compute the standard error.
- Multiply by z* to get the margin of error.
- Add and subtract the margin of error from p̂.
Example 3 — Raw data
Use the dataset 4, 6, 7, 9, 10 to build a 95% confidence interval for the mean.
- Compute the sample mean x̄.
- Compute the sample standard deviation s.
- Find SE = s/√n.
- Use the appropriate t* value with df = n−1.
- Build the interval as x̄ ± t*·SE.
Frequently Asked Questions
Q: What is a confidence interval?
A confidence interval is a range of plausible values for a population parameter based on sample data.
Q: Why does a 99% confidence interval look wider than a 95% interval?
Because higher confidence requires a larger critical value, which increases the margin of error.
Q: When should I use a t-interval instead of a z-interval?
Use a t-interval for a mean when the population standard deviation is unknown and you are using the sample standard deviation instead.
Q: Does a 95% confidence interval mean there is a 95% chance the true value is inside this specific interval?
Not exactly. It means the method used would capture the true parameter about 95% of the time over many repeated samples.