Confidence Interval for a Mean Calculator

StatisticsLast updated: August 22, 2026

A sample mean on its own is a point estimate, and it hides the uncertainty that comes from sampling randomness. A confidence interval for the mean shows the range within which the true population mean plausibly lies: writing "mean 27.73; 95% CI [24.86; 30.61]" instead of just "mean 27.73" tells the reader how precise the estimate is.

This calculator supports two input modes: you can paste raw data directly, or, if all you have are summary statistics (x̄, s, n), you can enter those. If the population standard deviation (σ) is unknown, the critical value comes from the t distribution; if it is known, it comes from the z distribution. That choice is made automatically and the distribution used is stated explicitly in the results. In measurement, quality control, health, and social science research, APA 7 and most journals expect a confidence interval to accompany any reported mean.

If you enter raw data, the mean and the standard deviation are computed by the calculator.
You can write the numbers separated by commas, spaces, or line breaks. Both a decimal point and a decimal comma are accepted (3.14 or 3,14).
In practice σ is almost never known; the standard choice is the t distribution.
The probability that the interval covers the true parameter.

Critical Values (t and z)

The width of the interval is set by the critical value and the standard error. The t critical values used when the population standard deviation is unknown depend on the degrees of freedom and approach z as the sample grows.

z (90% confidence)
1.6449
α = 0.10; the narrowest interval
z (95% confidence)
1.9600
α = 0.05; the academic standard
z (99% confidence)
2.5758
α = 0.01; about 31% wider than the 95% interval
t (95%, df = 9)
2.2622
n = 10 — with a small sample the interval widens noticeably
t (95%, df = 24)
2.0639
n = 25
t (95%, df = 99)
1.9842
n = 100 — already close to the z value
Margin of error and sample size
1 / √n
Halving the width of the interval requires roughly quadrupling the sample size

Values derived from the standard normal and Student t distributions; they do not change over timeKaynak: Standard normal (z) and Student t distribution tables; APA Publication Manual (7th edition) recommendation on reporting confidence intervals

Confidence Interval for a Mean

σ unknown:         CI = x̄ ± t(1−α/2; n−1) · s / √n
σ known:           CI = x̄ ± z(1−α/2) · σ / √n
Standard error:    SE = s / √n   (or σ / √n)
Margin of error:   ME = critical value × SE
Interval width:    W = 2 · ME
Degrees of freed.: df = n − 1
Mean:              x̄ = Σxᵢ / n
Standard dev.:     s = √[ Σ(xᵢ − x̄)² / (n − 1) ]

The critical value is selected automatically: t when σ is not entered, z when it is. The t distribution compensates with its heavier tails for the extra uncertainty of using s in place of σ, which is why it gives a wider interval than z at the same confidence level.

How to Calculate

  1. Choose the input mode: "Raw data" if you will paste the values, "Summary statistics" if you only have a summary.
  2. In raw data mode, write the values separated by commas, spaces, or line breaks; the mean and standard deviation are computed automatically.
  3. In summary mode, enter n, x̄, and s (s being the sample standard deviation with the n−1 denominator).
  4. If you genuinely know the population standard deviation, switch on the σ option; otherwise leave the default t option.
  5. Set the confidence level — 95% is the standard choice in academic work.
  6. Read the margin of error, the bounds, the critical value used, and the degrees of freedom together; the shaded curve shows what the interval corresponds to on the distribution.

Worked Examples

95% confidence interval from raw data

The mean of the 15 measurements is 27.73, the standard deviation 5.39, and the standard error 1.3920. With a t critical value of 2.1448 for df = 14, the margin of error is ±2.986 and the 95% confidence interval is [24.748; 30.719]; the width of the interval is 5.971.

95% confidence interval: [24.748; 30.719] · Lower bound: 24.748 · Upper bound: 30.719

Interval from summary statistics (x̄, s, n)

For n = 25, x̄ = 24.5, and s = 3.2, the standard error is 0.64. With a t critical value of 2.0639 at df = 24, the margin of error is ±1.321 and the 95% confidence interval is [23.179; 25.821] — the same values as the SPSS Explore output.

95% confidence interval: [23.179; 25.821] · Lower bound: 23.179 · Upper bound: 25.821

99% interval with z when σ is known

When the population standard deviation σ = 8 is known, the standard error for n = 100 is 0.8 and the z critical value is 2.5758; the margin of error is ±2.061 and the 99% confidence interval is [47.939; 52.061]. Had the same data been treated as having an unknown σ and computed with t, the critical value would have risen somewhat above 2.5758 and the interval would have been wider.

99% confidence interval: [47.939; 52.061] · Lower bound: 47.939 · Upper bound: 52.061

Frequently Asked Questions

What is the difference between this calculator and the general confidence interval calculator?
The general confidence interval calculator works only with summary statistics (n, x̄, s) and always uses t in mean mode. This calculator also accepts raw data, computes the mean and standard deviation itself, and chooses between t and z automatically depending on whether σ is known. It additionally returns the interval width, a comparison table across confidence levels, and a shaded distribution curve.
Should I use t or z?
Use z if the population standard deviation σ is known and t if it is not. Because σ is almost never known in practice, the correct choice is nearly always t. The rule "use z when n > 30" is only an approximation; since t converges to z on large samples anyway, using t is safe in every case.
Does a confidence interval mean "the true mean is in this range with 95% probability"?
Technically, no. The population mean is a fixed number; what varies from sample to sample is the interval itself. The 95% is the long-run coverage rate of the method: if samples of the same size were drawn from the same population again and again, about 95% of the intervals built would contain the true mean.
What can I do to narrow the interval?
Three factors matter: the sample size, the variability in the data, and the confidence level. The soundest route is to increase the sample; because the margin of error shrinks with 1/√n, halving the interval requires roughly quadrupling the sample. Lowering the confidence level from 95% to 90% narrows the interval but raises the risk of error and must always be stated in the report.
Is the result invalid if my data is not normally distributed?
The interval requires the sampling distribution of the mean, not the data itself, to be normal. Thanks to the central limit theorem, that condition holds approximately even for skewed data as the sample grows; n ≥ 30 is a rough guideline. For small, clearly skewed samples, or when strong outliers are present, a bootstrap interval or a median-based method should be preferred.
How do I get the same result in Excel, SPSS, and R?
In Excel the margin of error is =T.INV.2T(0.05, n−1)*s/SQRT(n), or directly =CONFIDENCE.T(0.05, s, n). In SPSS, the "95% Confidence Interval for Mean" row of Analyze → Descriptive Statistics → Explore gives the same values. In R, t.test(x)$conf.int returns the same interval in a single line.
How is a confidence interval related to a hypothesis test?
If a 95% confidence interval does not contain the tested value (μ₀), a two-tailed one-sample t-test gives p < 0.05; if it does contain it, p ≥ 0.05. This is why an interval carries both the significance information and information about the size and precision of the effect in a single line, telling you more than a p-value does.