Confidence Interval Calculator
A confidence interval is the estimate plus or minus a margin of error: x̄ ± z × σ ÷ √n for a mean, or p̂ ± z × √(p̂(1 − p̂) ÷ n) for a proportion. With x̄ = 68, σ = 3 and n = 25, the 95% interval is 68 ± 1.96 × 0.6: 66.82 to 69.18.
Last updated by Ultra Calculator
Confidence Interval
How to calculate it
Mean, σ known: x̄ ± z × σ ÷ √n Mean, σ unknown: x̄ ± t × s ÷ √n Proportion: p̂ ± z × √[ p̂(1 − p̂) ÷ n ]
- x̄
- the sample mean
- σ
- the population standard deviation, when it is known
- s
- the sample standard deviation
- n
- the sample size
- p̂
- the sample proportion (successes ÷ n)
- z, t
- the critical value for the confidence level, from the normal or t distribution
The margin of error is the part after ±. Textbook z values are 1.645, 1.960 and 2.576 for 90%, 95% and 99%, and t comes from the t distribution with n − 1 degrees of freedom. The calculator works out both for any confidence level, including custom ones.
Worked example
95% interval for a mean, σ known
A sample of 25 heights with mean 68 inches, from a population with σ = 3, has a standard error of 3 ÷ √25 = 0.6. The margin of error is 1.96 × 0.6 = 1.176, so the 95% interval runs from 66.824 to 69.176.
| Interval Type | Mean, population σ known (z) |
|---|---|
| Confidence Level | 95% |
| Sample Mean (x̄) | 68 |
| Population Standard Deviation (σ) | 3 |
| Sample Size (n) | 25 |
| Interval Type | Z-Interval for Mean |
|---|---|
| Confidence Interval | (66.8240, 69.1760) |
| Confidence Level | 95.0% |
| Margin of Error | 1.176 |
| Lower Bound | 66.824 |
| Upper Bound | 69.176 |
| Critical Value | 1.96 |
| Standard Error | 0.6 |
| Sample Mean | 68 |
| Sample Size | 25 |
How to use this calculator
- Choose the Interval Type: a mean with σ known, a mean with σ unknown, or a proportion.
- Choose the Confidence Level, or Custom and enter your own level as a decimal, such as 0.98.
- For a mean, enter the Sample Mean (x̄), the matching standard deviation (σ or s) and the Sample Size (n).
- For a proportion, enter the Sample Size (n) and either the Sample Proportion (p̂) or the Number of Successes.
- Read the Confidence Interval and the Margin of Error, with the critical value and standard error behind them.
Frequently asked questions
What does a 95% confidence interval mean?
If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true value. It does not mean there is a 95% chance the true value lies in this particular interval: that interval either contains it or not.
How do you calculate a confidence interval?
Work out the standard error (σ ÷ √n for a mean with σ known, s ÷ √n with σ unknown, or √(p̂(1 − p̂) ÷ n) for a proportion). Multiply it by the critical value for your confidence level to get the margin of error. Subtract and add the margin to the estimate to get the lower and upper bounds.
Should I use a z-interval or a t-interval?
Use z when the population standard deviation is genuinely known, which is rare outside quality control and textbook questions. When you only have the sample standard deviation, use t with n − 1 degrees of freedom. For large samples the two give almost the same answer.
What is the margin of error?
It is half the width of the interval: the amount added to and subtracted from the estimate. Polls often quote it, as in "42%, plus or minus 3 percentage points".
How do I make the interval narrower?
Increase the sample size or accept a lower confidence level. Because the margin shrinks with √n, halving it needs about four times as many observations. The sample size calculator works out how many you need.
When is the proportion interval reliable?
This calculator uses the normal approximation (the Wald interval), which needs at least 5 successes and 5 failures: n × p̂ and n × (1 − p̂) both 5 or more. Below that it shows a message instead of an interval. Meeting that threshold doesn't guarantee good coverage: the Wald interval can be too narrow, especially when p̂ is close to 0 or 1.
Learn more
What sets the width
Three things: the confidence level (through the critical value), the spread of the data (the standard deviation, or p̂(1 − p̂) for a proportion), and the sample size. More confidence or more spread widens the interval, and a larger sample narrows it.
Standard error
The standard error is the standard deviation of the estimate itself, not of the individual values. For a mean it is σ ÷ √n, so the mean of 100 observations has a tenth of the spread of a single observation.
Why t is wider than z for small samples
With σ unknown, the sample standard deviation adds its own uncertainty. The t distribution allows for this with heavier tails, so its critical values are larger: 2.093 for 95% with 19 degrees of freedom, against 1.960 for z.
- Reporting a survey result with its margin of error
- Putting a range around the average from a lab experiment
- Checking whether a target value falls inside the plausible range for a mean
- Comparing the precision of two studies of different sizes
- Coursework and exam questions on interval estimation
Entering percentages instead of decimals
The sample proportion and custom confidence level are decimals: type 0.6 for 60% and 0.95 for 95%.
Using the z-interval with a sample standard deviation
If σ came from your own sample, choose the σ unknown (t) option, which uses the larger t critical value. Treating s as σ makes small-sample intervals too narrow.
Reading the interval as a range for individual values
A confidence interval is for the mean or proportion, not for single observations. Individual values spread much more widely.
Choosing the confidence level after seeing the results
A 99% interval is wider than a 95% one from the same data, not more precise. Pick the level before you look at the interval and report it with the result.
- In Excel, =CONFIDENCE.NORM(0.05, σ, n) and =CONFIDENCE.T(0.05, s, n) give the margins of error of the two 95% mean intervals. Use 0.10 for 90% and 0.01 for 99%.
- Report the interval with its confidence level and sample size, for example 66.8 to 69.2 (95%, n = 25).
- Need a given margin of error? Work backwards with the sample size calculator.
Methodology and sources
The interval is the estimate plus or minus the critical value times the standard error. The z critical value is the normal quantile Φ⁻¹(1 − α ÷ 2), where α is 1 minus the confidence level: 1.645, 1.960 and 2.576 for 90%, 95% and 99%. The t critical value is the matching quantile of the t distribution with n − 1 degrees of freedom, for example 1.729 for 90% with 19 degrees of freedom. Both are worked out to full precision for any level, including custom ones. The proportion interval is the Wald interval: it needs n × p̂ and n × (1 − p̂) of at least 5 and is clipped to the range 0 to 1. Bounds show to 4 decimal places. Every interval assumes a random sample, and the mean intervals also assume roughly normal data or a large enough sample.