Confidence interval calculator
This confidence interval calculator finds the interval for a population mean or a proportion at 90%, 95%, 99% or any level you choose. It shows the standard error, the critical value, the margin of error and the working.
- Mean with t (σ unknown) or z (σ known)
- Proportion from successes and sample size
- Margin of error and steps shown
Last updated
How to use the confidence interval calculator
- Choose a mean (for averages such as test scores or heights) or a proportion (for yes/no data such as survey answers).
- For a mean, enter the sample mean, the standard deviation and the sample size. Tick the box only if σ is the known population value; otherwise the calculator uses t.
- For a proportion, enter the number of successes and the sample size.
- Pick 90%, 95%, 98%, 99% or another level, then read the interval and the working.
Confidence interval formulas
Every confidence interval is the estimate plus or minus the margin of error, and the margin of error is a critical value times the standard error.
mean, σ unknown: x̄ ± t* × s ÷ √n mean, σ known: x̄ ± z* × σ ÷ √n proportion: p̂ ± z* × √(p̂(1 − p̂) ÷ n)
t* comes from Student’s t distribution with n − 1 degrees of freedom, and z* from the standard normal distribution, so that the chosen percentage lies between −t* and t* (or −z* and z*). The calculator computes both exactly instead of using a table, so any confidence level works.
Worked example
A class of 30 students has a mean test score of 72.5 with a sample standard deviation of 8.4. Find a 95% confidence interval for the mean.
- Standard error: 8.4 ÷ √30 = 8.4 ÷ 5.4772 = 1.5336.
- σ is unknown, so use t with 30 − 1 = 29 degrees of freedom: t* = 2.0452 (2.045 in tables).
- Margin of error: 2.0452 × 1.5336 = 3.1366.
- Interval: 72.5 ± 3.1366, which is 69.36 to 75.64.
For a proportion: 120 of 300 people say yes, so p̂ = 0.40. SE = √(0.40 × 0.60 ÷ 300) = 0.0283, ME = 1.96 × 0.0283 = 0.0554, and the 95% interval is 0.3446 to 0.4554 (34.46% to 45.54%).
Critical values for common confidence levels
| Confidence level | z* | t* (df = 9) | t* (df = 29) |
|---|---|---|---|
| 90% | 1.645 | 1.833 | 1.699 |
| 95% | 1.960 | 2.262 | 2.045 |
| 98% | 2.326 | 2.821 | 2.462 |
| 99% | 2.576 | 3.250 | 2.756 |
t* is always larger than z* and shrinks toward it as the sample grows. With small samples, using z when you should use t makes the interval too narrow.
What a 95% confidence interval means
If you took many samples and built a 95% interval from each one, about 95% of those intervals would contain the true population value. It does not mean there is a 95% chance the true value is in your one interval; the true value is fixed, and your interval either contains it or not.
Higher confidence gives a wider interval. A larger sample gives a narrower one: to halve the margin of error, you need about four times as many observations, because the standard error shrinks with √n.
Common questions
How do you calculate a confidence interval?
Take the estimate and add and subtract the margin of error: critical value × standard error. For x̄ = 72.5, s = 8.4 and n = 30 at 95%: 72.5 ± 2.045 × 1.534 = 69.36 to 75.64.
What z-score is used for a 95% confidence interval?
z* = 1.960. For 90% it is 1.645 and for 99% it is 2.576. These leave 5%, 10% and 1% split between the two tails.
When do I use t instead of z?
Use t for a mean when you estimate the standard deviation from the sample, which is almost always. Use z when the population σ is known, and for proportions.
How do you find a confidence interval for a proportion?
Use p̂ ± z* × √(p̂(1 − p̂) ÷ n). For 300 voters out of 500 at 90%: 0.600 ± 1.645 × √(0.6 × 0.4 ÷ 500) = 0.600 ± 0.036, or 0.564 to 0.636.
How do you calculate the margin of error?
Multiply the critical value by the standard error. With t* = 2.045 and SE = 1.534, the margin of error is 3.14, so the interval is the mean ± 3.14.
Can I get a confidence interval without the standard deviation?
Not for a mean; you need s or σ. If you have the raw data, find s with the standard deviation calculator first. For a proportion, the standard deviation comes from p̂ itself.
Sources
- NIST/SEMATECH e-Handbook, 1.3.5.2 Confidence Limits for the Mean. Mean ± t(1 − α/2, N − 1) × s ÷ √N
- NIST/SEMATECH e-Handbook, 7.1.4 What are confidence intervals?. Mean ± z × σ ÷ √N when σ is known
- NIST/SEMATECH e-Handbook, 7.2.4.1 Confidence intervals for a proportion. Normal-approximation interval p̂ ± z√(p̂(1 − p̂)/n)
- OpenStax Introductory Statistics 2e, 8.3 A Population Proportion. Successes and failures both above 5; worked 90% example (0.564, 0.636)
- NIST/SEMATECH e-Handbook, 1.3.6.7.2 Critical Values of the Student’s t Distribution. Table check: t = 2.262 (9 df), 2.045 (29 df) at 0.025 upper tail
See the methodology page for how Studyfigure builds and checks its calculators.