Confidence Interval Calculator

Confidence interval for a population mean from x̄, a standard deviation, and n, or from a pasted data list. Default is the z interval with known σ; switch to the t interval when s is estimated from the sample.

For a proportion, use the proportion confidence interval calculator. Guides: confidence intervals explained, margin of error vs confidence interval.

What a confidence interval means

A 95% confidence interval for μ is a range built from sample data so that, if you repeated the same sampling and interval construction many times, about 95% of those intervals would contain the true μ. For the load-example data (x̄ = 50, σ = 10, n = 100 at 95%), that range is (48.04, 51.96), not “95% probability that μ is inside this one interval.”

Formulas (symbols defined)

SE = σ / √n (known σ) or SE = s / √n (estimated s)

Two-sided z interval: x̄ ± z_{α/2} · SE

Two-sided t interval: x̄ ± t_{α/2, n−1} · SE

x̄ = sample mean; σ = population SD (known); s = sample SD; n = sample size; α = 1 − (confidence level as a decimal).

When to use z vs t

Use the z interval only when σ is genuinely known (rare outside textbook exercises and manufacturing with long calibration history). Use the t interval when σ is unknown and estimated by s: the usual case. At n = 100 the difference is small (z = 1.96 vs t = 1.9840), but at n = 16 the t* = 2.1314 interval is noticeably wider than z = 1.96 would give.

What changes the width

Width grows with SD and confidence level and shrinks with √n. In the worked example, MOE = 1.96 × (10/√100) = 1.96. At 99% confidence the same data give (47.4242, 52.5758) because z = 2.5758. Quadrupling n to 400 would halve SE and roughly halve the margin.

Plan sample size with the sample size calculator or target a margin with the margin of error calculator. For σ unknown (the usual case), use the t interval calculator; see also standard error and z-score tools for the building blocks.

Software equivalents

  • Excel: CONFIDENCE.NORM(α, σ, n) and CONFIDENCE.T(α, s, n) return the margin (half-width), not the full interval: add and subtract from x̄.
  • Google Sheets: same function names as Excel.
  • R: t.test(x, conf.level = 0.95)$conf.int for the t interval from raw data.
  • Python: scipy.stats.t.interval(0.95, df=n-1, loc=xbar, scale=s/sqrt(n)).
  • TI-84: ZInterval (Stats) or TInterval when σ is unknown.

Worked example (matches Load example)

  1. SE = 10 / √100 = 1.0000.
  2. 95% z critical value = 1.96.
  3. Margin of error = 1.96 × 1 = 1.96.
  4. Interval: 50 ± 1.96 = (48.04, 51.96).

Frequently Asked Questions

What does a 95% confidence interval actually mean?

About 95% of intervals built the same way from repeated random samples would contain the true mean. It describes the method, not a 95% probability for this single interval after the data are observed.

Should I enter the sample SD or the population SD?

Almost always treat your SD as a sample estimate and choose the t interval. The default on this page is the z interval with known σ to match classical textbook setups: switch to estimated SD when σ is unknown.

Why is my 99% interval wider than my 95% interval?

Higher confidence requires a larger critical value. For the example with σ = 10 and n = 100, the margin grows from 1.96 to 2.5758 when moving from 95% to 99%.

How do I compute a confidence interval in Excel?

Use CONFIDENCE.NORM(0.05, σ, n) or CONFIDENCE.T(0.05, s, n) for a 95% margin (α = 0.05), then form x̄ ± that margin. CONFIDENCE returns the half-width only.

Can I paste raw data instead of typing the mean?

Yes. Choose raw data input; the calculator computes x̄ and, for a t interval, s automatically. For a z interval you still supply known σ.

When is a t interval required?

Whenever σ is unknown and estimated by s, especially for small n. The t distribution has heavier tails, so the interval is wider and better calibrated than z with s plugged in for σ.

How does sample size affect the interval?

The margin is proportional to 1/√n, so quadrupling n halves the margin if SD stays similar. Larger n also reduces t* toward z.

Where do I get an interval for a proportion?

Use the proportion confidence interval calculator on this site for x and n counts, or the sample size tool if you are planning a survey margin of error.

Embed This Calculator

Add this free calculator to your course page or LMS.

Adjust the height value to fit your page.