Confidence Interval Calculator

This confidence interval calculator computes the confidence interval for a population mean based on sample data. Enter the sample mean, standard deviation, sample size, and confidence level, and the tool returns the margin of error along with the lower bound and upper bound of the interval.

Population Mean

Estimate a confidence interval for the mean

%

Results

Live

95% Confidence Interval

[94.3989, 105.6011]

100.0000 ± 5.6011

-t+t
Standard Error
2.7386
t-critical
2.045
Margin of Error
± 5.6011
Distribution
t (df=29)
We are 95% confident that the true population mean lies between 94.3989 and 105.6011. Because the population standard deviation is unknown, the t-distribution was used for a more accurate interval.
William Davis

Created by William Davis

Last updated: July 29, 2026

Add to Google Preferred
1

What Is a Confidence Interval?

A confidence interval is a range of values, calculated from sample data, that is likely to contain the true value of a population parameter. For a mean confidence interval, that parameter is the population mean: a fixed but unknown value that the sample is used to estimate. Because no sample perfectly represents a full population, confidence interval estimation produces a range rather than a single figure, acknowledging the inherent uncertainty in working with incomplete data.

The confidence level controls how often that range can be expected to capture the true value. At a confidence level of 95%, if the same sampling procedure were repeated many times, 95% of the resulting intervals would contain the true population mean. The 5% that do not are not errors in calculation. They are the expected cost of working at that level of certainty. Researchers who require tighter assurance typically move to a confidence level of 99%, accepting a wider interval in return.

A common misconception is that a single computed 95% confidence interval has a 95% probability of containing the true value. That framing is not accurate. Once an interval is calculated from a given sample, the true population mean either falls inside it or it does not. No probability applies to that specific result. What is a 95% confidence interval, then? It is an interval produced by a method that, applied across repeated samples of the same size, would contain the true parameter value 95% of the time.

Results are typically reported in two equivalent formats: X̄ ± margin of error (for example, 74 ± 3) or as a bracketed range [lower bound, upper bound] (for example, [71, 77]). Both describe the same interval. The same general logic applies whether the goal is a confidence interval for a mean or a confidence interval for a proportion, though the formulas differ. This calculator handles the mean.

2

Confidence Interval Formula: How the Calculation Works

The confidence interval formula for a population mean follows this structure:

X̄ ± (critical value) × (σ / √n)

Each variable in that expression has a specific role. X̄ is the sample mean, the average calculated from the collected data. σ is the standard deviation, either the known population standard deviation or the sample standard deviation used as a substitute. n is the sample size, the total number of observations. The critical value is drawn from either the standard normal distribution or the t distribution, depending on what is known about the data.

Standard Error of the Mean

The term σ / √n is the standard error of the mean. It measures how much the sample mean is expected to vary from one sample to the next, given the same population and sample size. A smaller standard error indicates that the sample mean is a more stable estimate. The standard error formula works the same way whether σ represents the population standard deviation or the sample standard deviation s.

Margin of Error

The margin of error is the product of the critical value and the standard error. It is the distance added to and subtracted from the sample mean to form the interval. A larger critical value (from a higher confidence level) or a larger standard error (from more variable data or a smaller sample) both produce a larger margin of error and a wider interval.

Once the margin of error is known, the bounds follow directly:

Lower bound = X̄ minus margin of error

Upper bound = X̄ plus margin of error

3

Worked Example

To make the confidence interval calculation steps concrete, consider the following values:

Sample size (n)
50
Sample mean (X̄)
22
Population SD (σ)
4
Confidence level
95%

Step 1: Calculate the standard error.

σ / √n = 4 / √50 = 4 / 7.071 = 0.566

Step 2: Identify the Z critical value for a two sided confidence interval at 95%.

Z = 1.960

Step 3: Calculate the margin of error.

1.960 × 0.566 = 1.109

Step 4: Find the bounds.

Lower bound = 22 − 1.109 = 20.891

Upper bound = 22 + 1.109 = 23.109

The 95% confidence interval is [20.891, 23.109]. This is the range within which the true population mean is expected to fall, based on this sample.

Z-Value Reference Table

When population standard deviation is known and the normal distribution applies, use the Z values below. These correspond to the most commonly used confidence levels in statistics.

Confidence LevelZ-Value
90%1.645
95%1.960
98%2.326
99%2.576

For confidence levels not listed here, the appropriate Z value can be found using a standard z score table for confidence interval work or a normal distribution calculator.

4

Z-Score vs. T-Distribution: Which to Use in a Confidence Interval Calculation

Choosing the correct distribution is one of the most practical decisions in confidence interval work. The choice depends on whether the population standard deviation is known and how large the sample is.

When to Use the Z-Distribution

Use the Z-distribution when the population standard deviation is known. This produces a confidence interval with known standard deviation that uses the standard normal distribution to determine the critical value, as shown in the reference table above. The Z-distribution is also appropriate when the sample size is 30 or more, even if the population standard deviation is unknown, because the sample standard deviation becomes a reliable proxy at that scale.

When to Use the T-Distribution

Use the t distribution confidence interval approach when the population standard deviation is unknown and the sample is small, typically fewer than 30 observations. In this case the calculation uses the sample standard deviation and draws the critical value from the t distribution rather than the standard normal curve.

The t score confidence interval requires one additional input: degrees of freedom. For a single sample mean, degrees of freedom is calculated as n minus 1. A sample of 15 observations, for example, uses 14 degrees of freedom. The t critical value is then read from the t distribution at that degrees of freedom and the chosen confidence level. Because the t distribution has heavier tails than the normal distribution, the t critical value is always larger than the corresponding Z value, which produces a wider interval. That added width reflects the extra uncertainty that comes with a small sample and a confidence interval with unknown standard deviation.

The degrees of freedom confidence interval relationship is important to understand: as sample size increases, the t distribution approaches the normal distribution. At around 30 or more degrees of freedom, the t critical value and the Z critical value are nearly identical, and the distinction between the two methods has minimal practical effect on the result.

Why the Choice Matters

Using the Z-distribution when the T-distribution is appropriate will produce a confidence interval that is too narrow, understating the true uncertainty in the estimate. Using the T-distribution when the Z-distribution is appropriate will produce an interval that is slightly wider than necessary, though the error is small for large samples. Neither mistake is catastrophic at large sample sizes, but in small samples the difference is meaningful.

This calculator selects the appropriate distribution automatically. When a known population standard deviation is entered, the tool applies the Z-distribution. When only a sample standard deviation is available, it applies the t distribution. No manual selection is required.

5

How to Interpret Confidence Interval Results

Once the calculator returns a result, three values appear: the margin of error, the lower bound, and the upper bound. Reading those values correctly is as important as calculating them.

What the Bounds Tell You

The lower bound and upper bound together define the confidence interval width, the range within which the true population mean is expected to fall at the selected confidence level. If a 95% confidence interval returns bounds of [18.4, 25.6], the interpretation is that this interval was produced by a method that captures the true population mean in 95% of repeated samples of the same size. It does not mean there is a 95% probability that the true mean sits between 18.4 and 25.6 in this specific instance. The true mean is fixed. The interval either contains it or it does not.

For a 99% confidence interval, the same logic applies with a higher confidence level and a correspondingly wider interval. What is a 99% confidence interval? It is an interval produced by a method that would contain the true parameter value in 99 out of 100 repeated samples, at the cost of a less precise range.

What the Margin of Error Represents

The margin of error is the half-width of the interval. It represents the maximum expected difference between the sample estimate and the true population parameter in either direction. A margin of error of 3.6 means the lower bound sits 3.6 units below the sample mean and the upper bound sits 3.6 units above it. The margin of error is a single number, while the confidence interval is the full range it defines around the mean.

Narrow vs. Wide Intervals

Confidence interval precision is reflected in the width of the interval. A narrow confidence interval signals a more precise estimate. It results from a large sample size, low variance in the data, or a lower confidence level. A wide confidence interval signals less precision and more uncertainty. It typically results from a small sample, high variance, or a high confidence level requirement.

The relationship between variance and confidence interval width is direct: higher variance in the data increases the standard error, which increases the margin of error, which widens the interval. The sample size and confidence interval width move in opposite directions: larger samples produce narrower intervals because they reduce the standard error.

If an interval is too wide to support a meaningful decision, the most effective remedy is increasing the sample size. Reducing measurement variability, where that is possible in the study design, also helps. Lowering the confidence level will narrow the interval but at the cost of reduced certainty.

Confidence Intervals and Statistical Significance

A confidence interval carries information about statistical significance. If a 95% confidence interval for a mean difference does not include zero, the result is consistent with a statistically significant finding at the 0.05 level. This connection between confidence interval and hypothesis testing means that the interval can serve as a more informative complement to a p-value, showing not just whether an effect exists but how large it plausibly is and in which direction.

Some analyses also use a confidence band rather than a single interval, particularly in regression and time series contexts where the interval widens or narrows across a range of values. The interpretation follows the same principle: the band defines the region of most probable values at the selected confidence level.

6

What Affects the Width of a Confidence Interval

The confidence interval sample size, the standard deviation, and the confidence level are the three inputs that directly control how wide or narrow a result will be. Changing any one of them while holding the others fixed produces a measurable and predictable shift in the interval width.

Sample Size

Sample size has the strongest practical effect on interval width, and the relationship runs through the standard error. Because the standard error equals σ divided by the square root of n, increasing n reduces the standard error and tightens the interval. The sample size effect on margin of error follows a square root relationship: to cut the margin of error in half, the sample size must be quadrupled. Doubling the sample size reduces the margin of error by roughly 29%, not 50%. This is an important detail when planning a study with a target precision in mind.

A larger confidence interval sample size also makes the Z and T distributions nearly interchangeable, as discussed above. For most applied purposes, the sample size is the most actionable lever available for improving interval precision.

Standard Deviation

Greater variability in the data produces a wider interval. The standard deviation measures spread within the data, and the confidence interval inherits that spread through the standard error. A sample drawn from a highly variable population will produce a wider interval than one drawn from a more uniform population, all else being equal.

Reducing measurement noise through more consistent data collection methods, tighter eligibility criteria for a study, or a more homogeneous sampling frame all help reduce the effective standard deviation and narrow the interval. These are design decisions rather than post-hoc calculations.

Confidence Level

A higher confidence level demands a larger critical value. Moving from a 95% to a 99% confidence interval means using a Z value of 2.576 instead of 1.960, which increases the margin of error and widens the interval. This is the direct trade-off at the center of what affects confidence interval width: higher certainty costs precision, and lower certainty buys a tighter range.

A one sided confidence interval uses a smaller critical value than the corresponding two sided interval at the same confidence level, because all of the allowable error is placed on one tail rather than split across both. One sided intervals are used when the direction of the difference is known in advance, and they produce a narrower bound on that side as a result.

Summary Table

The table below shows how changing one factor affects interval width while the others remain constant.

FactorChangeEffect on Interval Width
Sample size (n)IncreasesNarrows
Sample size (n)DecreasesWidens
Standard deviation (σ or s)IncreasesWidens
Standard deviation (σ or s)DecreasesNarrows
Confidence levelIncreases (e.g., 95% to 99%)Widens
Confidence levelDecreases (e.g., 95% to 90%)Narrows
?

Frequently Asked Questions

Q

What is the z-score for a 95% confidence interval?

The Z-value for a two-sided 95% confidence interval is 1.960, corresponding to the 97.5th percentile of the standard normal distribution N(0,1). This is the critical value used by any 95% confidence interval calculator that applies the Z-distribution, which is appropriate when the population standard deviation is known or the sample size is 30 or more.

Q

What is the z-score for a 99% confidence interval?

The Z-value for a two-sided 99% confidence interval is 2.576. A 99% confidence interval calculator applies this critical value in place of 1.960, producing a wider interval that reflects the higher certainty requirement. The trade-off is reduced precision for increased confidence.

Q

What is the difference between a confidence interval and a margin of error?

The margin of error is the half-width of the confidence interval. It is the value added to and subtracted from the sample mean to produce the lower and upper bounds. A standalone margin of error calculator returns this single figure, while a confidence interval calculator returns the full range. The two are directly related: the confidence interval is always the sample mean plus and minus the margin of error.

Q

What does a wider confidence interval indicate?

A wider interval indicates less precision in the estimate. It typically results from a smaller sample, higher variability in the data, or a higher confidence level requirement. This same principle applies whether the goal is a confidence interval for a mean or a confidence interval for standard deviation. In the latter case, the chi-squared distribution is used rather than the normal or t distribution, and the interval is asymmetric around the sample standard deviation, but a wider result still signals greater uncertainty in the estimate.

Q

Can a confidence interval include negative values?

Yes. If the sample mean is close to zero and the margin of error is large, the lower bound can be negative. This is mathematically valid and depends entirely on the data and the scale being measured. It is not an error in the calculation.

Q

How does sample size affect a confidence interval?

Increasing the sample size reduces the standard error, which narrows the margin of error and tightens the confidence interval around the sample mean. For quick calculations during study planning, a standard error calculator can help estimate how much the standard error will shrink at a target sample size before data collection begins.

Q

What types of confidence intervals does this calculator support?

This free confidence interval calculator handles confidence intervals for a population mean, using either the Z-distribution or the t-distribution depending on whether the population standard deviation is known. For those working with proportion data rather than continuous measurements, a separate proportion confidence interval calculator is the appropriate tool, as it uses a different formula based on the sample proportion rather than the sample mean. A confidence level calculator or online confidence interval calculator that supports raw data input will typically allow the user to paste values directly and compute the mean, standard deviation, and interval in a single step, as this confidence interval calculator for mean does.