A sample mean or a sample percentage is only an estimate: draw another sample and you will get a slightly different number. A confidence interval puts honest error bars around the estimate. A 95% confidence interval is built by a method that captures the true population value in 95% of samples, so you can be fairly confident, though never certain, that your interval contains it.
Every interval has the same structure: estimate ± critical value × standard error. The standard error measures how much the estimate varies from sample to sample (s ÷ √n for a mean, √(p̂(1 − p̂) ÷ n) for a proportion). The critical value depends on the confidence level: z* = 1.96 for 95% from the normal distribution, or a slightly larger t* when the standard deviation itself comes from the sample. With 40 observations, for example, t* = 2.023 instead of 1.96.
The calculator handles three common situations for means (sample standard deviation for a t interval, known population σ for a z interval, or a standard error you already have) and the normal-approximation interval for proportions, with the Wilson interval as a safer alternative. The chart shows the sampling distribution with the interval shaded.
How to use the Confidence Interval Calculator
- Calculate a confidence interval for
- Sample mean (x̄)
- Spread you know
- Standard deviation or standard error
- Sample proportion (p̂)
- Sample size (n)
- Confidence level
- Custom confidence level
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The tool finds the standard error, picks the critical value from the t distribution with n − 1 degrees of freedom (or the normal distribution when σ is known or for proportions) at 1 − α/2, multiplies them to get the margin of error and adds and subtracts it from the estimate.
Worked example
A sample of n = 40 adults has a mean resting heart rate of 72.5 bpm with s = 8.2 bpm. The standard error is 8.2 ÷ √40 = 1.297. With 39 degrees of freedom, t* for 95% is 2.0227, so the margin of error is 2.0227 × 1.297 = 2.62 bpm and the 95% confidence interval is 69.88 to 75.12 bpm. If σ = 8.2 were known, the z interval would be slightly narrower: 72.5 ± 1.96 × 1.297 = 69.96 to 75.04 bpm.
Critical values for common confidence levels
| Confidence level | z* | t* (df = 10) | t* (df = 30) |
|---|---|---|---|
| 80% | 1.2816 | 1.3722 | 1.3104 |
| 90% | 1.6449 | 1.8125 | 1.6973 |
| 95% | 1.9600 | 2.2281 | 2.0423 |
| 98% | 2.3263 | 2.7638 | 2.4573 |
| 99% | 2.5758 | 3.1693 | 2.7500 |
Formula
Mean: x̄ ± t* × s ÷ √n (or z* × σ ÷ √n when σ is known) · Proportion: p̂ ± z* × √(p̂(1 − p̂) ÷ n) · margin of error E = critical value × standard error
Worked example
Inputs: Calculate a confidence interval for: A population mean; Sample mean (x̄): 72.5; Spread you know: Sample standard deviation s (t interval); Standard deviation or standard error: 8.2; Sample size (n): 40; Confidence level: 95%.
Results: Confidence interval = 69.8775 to 75.1225 (72.5 ± 2.6225); Lower bound = 69.8775; Upper bound = 75.1225; Margin of error (±) = 2.6225; Standard error = 1.2965; Critical value = 2.0227.
Key terms
- Confidence level
- Long-run share of intervals that contain the true parameter (1 − α).
- Standard error
- Standard deviation of the estimate across repeated samples.
- Critical value
- z* or t* that cuts off α/2 in each tail.
- Margin of error
- Half the width of the interval, critical value × standard error.
Frequently asked questions
How do you calculate a 95% confidence interval for a mean?
x̄ ± t* × s ÷ √n. For x̄ = 72.5, s = 8.2 and n = 40: SE = 1.297, t* (39 df) = 2.023, so the interval is 72.5 ± 2.62 = 69.88 to 75.12.
When should I use t instead of z?
Use t whenever the standard deviation is estimated from the sample. Use z only when the population σ is genuinely known, or for proportions.
What does 95% confidence actually mean?
That 95% of intervals built this way from repeated samples would contain the true value. It does not mean there is a 95% probability the true value is in this particular interval.
How does sample size affect the interval?
The width shrinks with √n: quadrupling the sample halves the margin of error.
Why is a 99% interval wider than a 95% one?
Higher confidence needs a larger critical value (2.576 instead of 1.96 for z), so the interval must be wider to be more certain.
How do I get a confidence interval for a proportion?
p̂ ± z* √(p̂(1 − p̂)/n). For 62% of 250: 62% ± 1.96 × 3.07% = 55.98% to 68.02%.
What if my sample is small and the data are skewed?
The t interval assumes roughly normal data for small n. With strong skew and n below about 30, consider a bootstrap interval or a transformation.
Can I enter a confidence level that is not in the list?
Yes. Choose "Other…" and type any level, such as 93% or 97.5%.