Confidence Interval Calculator
Calculate a confidence interval for a population mean from the sample mean, standard deviation and sample size, using t or z, with the margin of error and every step.
- Lower bound
- 67.8722
- Upper bound
- 76.1278
- Margin of error (E)
- 4.1278
- Added to and subtracted from x̄
- Sample mean (x̄)
- 72
- Standard error (SE)
- 2
- s / √n
- Critical value (t*)
- 2.0639
- t-distribution, df = 24
- Degrees of freedom
- 24
- n − 1
- Confidence level
- 95%
Confidence interval visualization
Step-by-step calculation
Step 1: Write down the given values
σ is unknown, so the sample standard deviation s is used with the t-distribution.
x̄ = 72, s = 10, n = 25, confidence level = 95%
Step 2: Standard error
How much the sample mean would typically vary from sample to sample: the spread divided by √n.
SE = s / √n = 10 / √25 = 10 / 5
SE = 2
Step 3: Degrees of freedom
The t-distribution depends on how much information the sample gives about the spread.
df = n − 1 = 25 − 1 = 24
Step 4: Critical value
For 95% confidence, α = 1 − 0.95 = 0.05, and 0.025 of the t distribution lies beyond t* in each tail.
t* (df = 24) ≈ 2.0639
Step 5: Margin of error
E = t* × SE ≈ 2.0639 × 2
E ≈ 4.1278
Step 6: Confidence interval
Subtract and add the margin of error to the sample mean.
x̄ ± E = 72 ± 4.1278
Lower bound = 72 − 4.1278 ≈ 67.8722
Upper bound = 72 + 4.1278 ≈ 76.1278
What this interval means
Using a 95% confidence level, the confidence interval for the population mean is 67.8722 to 76.1278.
In plain terms: based on this sample, population means between 67.8722 and 76.1278 are plausible, and the method used to build the interval captures the true mean 95% of the time.
Precisely: if the same sampling procedure were repeated many times and a 95% confidence interval were built each time, about 95% of those intervals would contain the true population mean.
It does not mean there is a 95% probability that the true mean lies in this particular interval (the true mean is fixed; this interval either contains it or not), and it does not mean 95% of individual observations fall between these bounds. The result is only as good as the assumptions: a random, independent sample, and for small samples a population that is roughly normal.
Sample size effect: with the same sample SD and a sample 4 times larger (n = 100), the standard error would halve to 1 and the margin of error would shrink to about 1.9842.
Confidence interval formulas
CI = estimate ± margin of error
t: x̄ ± t* × s / √n
z: x̄ ± z* × σ / √n
- x̄
- sample mean
- s
- sample standard deviation (spread of the data)
- σ
- population standard deviation, when known
- n
- sample size
- SE
- standard error, s/√n or σ/√n (spread of the sample mean)
- t*, z*
- critical value for the confidence level
- E
- margin of error = critical value × SE
| Feature | z | t |
|---|---|---|
| Population SD known | Yes | No |
| Spread used | σ | Sample s |
| Degrees of freedom | Not applicable | n − 1 |
| Tails | Normal | Heavier, so wider intervals |
| 95% critical value | 1.960 | 2.064 (df 24), 2.009 (df 50) |
As the degrees of freedom grow, the t-distribution approaches the standard normal, so t* approaches z*.
Need the inputs first? Get the mean and standard deviation of your data with the Standard Deviation Calculator or the Average Calculator. To plan how many observations you need for a target margin of error, use the Sample Size Calculator; to test a difference in means, the T-Test Calculator; and to see where one value sits relative to the mean, the Z-Score Calculator.
A confidence interval gives a range of plausible values for a population mean, built from a sample. With a sample mean of 72, a standard deviation of 10 and 25 observations, the 95% confidence interval is about 67.87 to 76.13, which is 72 ± 4.13.
Enter the sample mean, standard deviation and sample size, choose 90%, 95%, 99% or a custom confidence level, and say whether the population standard deviation is known. The calculator uses the t-distribution (or z when σ is known) and shows the interval, margin of error, standard error, critical value, a chart and a step-by-step calculation, with a correct plain-language interpretation.
Worked Calculation Examples
| Scenario | Result | Calculation Step |
|---|---|---|
| 95% confidence interval with the t-distribution | 67.8722 to 76.1278 | σ is unknown, so use t with df = 25 − 1 = 24. SE = 10 / √25 = 10 / 5 = 2. t* ≈ 2.0639. E ≈ 2.0639 × 2 ≈ 4.1278. Interval: 72 ± 4.1278, from 67.8722 to 76.1278. |
| 95% confidence interval with the z-distribution | 96.325 to 103.675 | σ = 15 is known, so use z. SE = 15 / √64 = 15 / 8 = 1.875. z* ≈ 1.96. E ≈ 1.96 × 1.875 ≈ 3.675. Interval: 100 ± 3.675, from about 96.325 to 103.675 (with the unrounded z* = 1.95996, E = 3.6749). |
| 99% confidence interval: more confidence, wider interval | 66.4061 to 77.5939 | Same data as the first example. SE = 2 and df = 24, but t* rises to ≈ 2.7969, so E ≈ 5.5939 and the interval is 66.4061 to 77.5939, about 1.47 wider on each side than the 95% interval. |
What Is a Confidence Interval?
A confidence interval is a range of plausible values for a population parameter, such as a population mean, based on sample data and a chosen confidence procedure. The steps are: take a sample, compute an estimate (the sample mean), work out a margin of error from the variability and the sample size, and report the estimate ± the margin of error.
Example: a café times 25 randomly chosen orders and finds a mean of 72 seconds with a standard deviation of 10 seconds. The 95% confidence interval for the mean time of all orders is 72 ± 4.13, or 67.87 to 76.13 seconds.
The confidence level describes the method, not one particular interval: if you repeated the sampling many times and built a 95% interval each time, about 95% of those intervals would contain the true mean. It does not mean there is a 95% probability that the true mean lies in the interval you calculated, and it says nothing about where 95% of individual orders fall.
How to Calculate a Confidence Interval
1. Find the sample mean x̄, the standard deviation (s, or σ if known) and the sample size n.
2. Compute the standard error: SE = s / √n.
3. Find the critical value for your confidence level: t* with n − 1 degrees of freedom, or z* if σ is known.
4. Multiply to get the margin of error: E = t* × SE.
5. The interval is x̄ − E to x̄ + E.
For x̄ = 72, s = 10, n = 25 at 95%: SE = 10 / √25 = 2, df = 24, t* ≈ 2.0639, E ≈ 2.0639 × 2 ≈ 4.1278, so the interval is 67.8722 to 76.1278.
Standard Deviation, Standard Error and Margin of Error
These three are easy to confuse. The standard deviation (s or σ) measures how spread out individual observations are. The standard error, SE = s / √n, measures how much the sample mean itself would vary from one sample to another; it shrinks as the sample grows. The margin of error, E = critical value × SE, is the amount added to and subtracted from the sample mean to form the confidence interval.
Z vs T Distribution
Use the t-distribution when the population standard deviation is unknown and you estimate it with the sample standard deviation s. This is the usual situation. The t-distribution has heavier tails than the normal distribution, which allows for the extra uncertainty in s, so t-intervals are a little wider. Its shape depends on the degrees of freedom, df = n − 1: with few observations the estimate of spread is shaky and t* is large (12.71 for df = 1 at 95%), and as df grows t* falls towards the normal value (2.064 for df = 24, 1.984 for df = 99, 1.960 in the limit).
Use the z-distribution when the population standard deviation σ is known, for example from a long-running, well-studied process. A large sample does not by itself turn a t-interval into a z-interval; it only makes the two nearly identical.
Confidence Level Comparison
For the same data, a higher confidence level gives a wider interval, because the method must capture the true mean more often. With x̄ = 72, s = 10 and n = 25:
90%: t* ≈ 1.711, interval 68.58 to 75.42 (narrower).
95%: t* ≈ 2.064, interval 67.87 to 76.13 (the common standard).
99%: t* ≈ 2.797, interval 66.41 to 77.59 (wider).
The choice is a trade-off between confidence and precision; 95% is the usual default in science and business.
Sample Size and the Confidence Interval
With the same method and similar variability, a larger sample gives a smaller standard error and a narrower interval. Because SE = s / √n, quadrupling the sample halves the standard error. With s = 10: n = 25 gives SE = 2 and a 95% margin of error of about 4.13; n = 100 gives SE = 1 and a margin of about 1.98 (t* also drops slightly, from 2.064 to 1.984).
In real data the sample standard deviation also changes from sample to sample, so a bigger sample usually, but not always, gives a narrower interval.
Confidence Interval Assumptions
Whether this interval is appropriate depends on how the data were collected, not on the arithmetic. The standard interval for a mean assumes:
A random sample (or random assignment) from the population of interest.
Independent observations, with no clustering and no repeated measurements of the same unit counted separately.
For small samples, a population that is reasonably close to normal; strong skew or outliers can make a t-interval misleading. With larger samples the interval is more robust, thanks to the central limit theorem.
The correct choice of z or t, depending on whether the population standard deviation is known.
The calculator cannot check these conditions; look at how the sample was taken and plot the data first.
Confidence Interval vs Margin of Error
The margin of error is the distance from the estimate to either end of the interval. The confidence interval is the estimate ± the margin of error. For 72 ± 4.13, the margin of error is 4.13 and the confidence interval is 67.87 to 76.13; the full width of the interval is twice the margin of error.
Confidence Interval vs Prediction Interval
A confidence interval estimates a population parameter, such as the mean order time. A prediction interval estimates where a single future observation, such as the next order, is likely to fall. Individual values vary much more than the mean does, so a prediction interval is much wider. For the café data, the mean is pinned down to about ±4 seconds, but an individual order could easily be 20 seconds from the mean.
How to Use the Confidence Interval Calculator
- Enter the sample mean, the sample standard deviation and the sample size (the number of observations).
- Choose a confidence level: 90%, 95% (the default) or 99%, or enter a custom level.
- Say whether the population standard deviation σ is known. If not (the usual case), the calculator uses the t-distribution with n − 1 degrees of freedom; if it is, enter σ and it uses the z-distribution.
- Read the interval, lower bound ≤ μ ≤ upper bound, with the margin of error, standard error and critical value.
- Follow the step-by-step calculation, compare the interval at other confidence levels in the chart, and read the interpretation to report it correctly.
Frequently Asked Questions
What is a confidence interval?
A range of plausible values for a population parameter, such as a mean, calculated from sample data: the estimate ± a margin of error. For example, 72 ± 4.13, or 67.87 to 76.13.
How do you calculate a confidence interval?
Find the standard error SE = s / √n, multiply it by the critical value (t* with n − 1 degrees of freedom, or z* if σ is known) to get the margin of error E, and report x̄ − E to x̄ + E.
What is a 95% confidence interval?
An interval built by a method that captures the true population mean in about 95% of repeated samples. It is the most common choice of confidence level.
How do you calculate a 95% confidence interval?
Use a 95% critical value: z* = 1.96 if σ is known, or t* for n − 1 degrees of freedom (2.064 for n = 25). Then x̄ ± critical value × s / √n. For x̄ = 72, s = 10, n = 25: 72 ± 2.0639 × 2 = 67.87 to 76.13.
What is the margin of error?
The amount added to and subtracted from the sample mean to form the confidence interval: E = critical value × standard error. It reflects both the chosen confidence level and the sampling variability.
What is the difference between a confidence interval and margin of error?
The margin of error is one number, the distance from the estimate to either bound. The confidence interval is the range estimate ± margin of error. 72 ± 4.13 has margin of error 4.13 and interval 67.87 to 76.13.
When should I use a z-distribution?
When the population standard deviation σ is known, rather than estimated from the sample. This is uncommon in practice; a large sample alone is not a reason to switch, although t and z give nearly the same answer then.
When should I use a t-distribution?
When σ is unknown and you use the sample standard deviation s, which is the usual case. The t critical value, with n − 1 degrees of freedom, accounts for the extra uncertainty from estimating the spread.
What are degrees of freedom?
For a one-sample mean interval, df = n − 1: the number of independent pieces of information left for estimating the spread after the mean is estimated. Fewer degrees of freedom mean heavier t tails and a larger critical value.
Does a larger sample size make a confidence interval narrower?
Usually. With the same method and similar variability, the standard error s / √n shrinks as n grows, so quadrupling n roughly halves the margin of error. In real data s also varies, so it is not guaranteed for every sample.
Why is a 99% confidence interval wider than a 95% interval?
To capture the true mean more often, the method needs a larger critical value: z* rises from 1.96 to 2.576, and t* rises similarly, so with the same data the margin of error, and the interval, get wider.
What does a confidence interval actually mean?
The confidence level describes the procedure: if you repeated the sampling many times, about 95% of the 95% intervals would contain the true mean. It does not mean there is a 95% probability that the fixed true mean lies in your particular interval, and it does not mean 95% of individual values fall inside it.
Related Calculators
Z-Score Calculator
Calculate a z-score from a value, mean and standard deviation, with the steps, what it means, a bell-curve chart and the normal-distribution percentile.
Standard Deviation Calculator
Calculate sample and population standard deviation and variance of a dataset, with the mean, a deviation table and step-by-step working.
Sample Size Calculator
Find the minimum sample size for a survey from the confidence level, margin of error, expected proportion and optional population size, with every step shown.
T-Test Calculator
Run a one-sample, independent two-sample (Welch or pooled) or paired t-test from raw data or summary statistics, with the p-value, confidence interval and every step.
Average Calculator
Calculate the average (mean) of a list of numbers with the median, mode and range, or a weighted average, with step-by-step working.
Probability Calculator
Calculate simple probability from favorable and total outcomes, as a percentage, decimal, and simplified fraction, with the complement and step-by-step working.
Last updated: September 27, 2026.