Skip to content
UnitFormula

A confidence interval for a mean is the sample mean plus or minus a margin of error: x̄ ± z·σ/√n, where z is the critical value for your confidence level (1.645 for 90%, 1.96 for 95%, 2.576 for 99%). For a mean of 2 with σ = 1 and n = 100 at 95% confidence, the margin is 1.96 × 1/√100 = 0.196, giving the interval (1.804, 2.196).

Confidence Interval Calculator — for a mean (z-interval)

95% confidence interval for a mean of 2 (σ = 1, n = 100).

Margin of error (±)0.196
Lower limit
1.804
Upper limit
2.196

Quick examples

How it's calculated

  1. Margin of error = z × σ ÷ √nE=zσnE = z \, \dfrac{\sigma}{\sqrt{n}}
    z
    = 1.96
    sigma
    = 1
    n
    = 100
    0.196
  2. Interval = mean ± margin of errorxˉ±E\bar{x} \pm E
    mean
    = 2
    E
    = 0.196
    1.8
Margin of error (±)0.196

How it works

A confidence interval turns a single sample mean into a range that is likely to contain the true population mean. For a mean when the population standard deviation σ is known (or the sample is large), the interval is:

x̄ ± z × (σ ÷ √n)

The piece added and subtracted, E = z × σ ÷ √n, is the margin of error. It has three ingredients:

  • z, the critical value from the standard normal distribution for your confidence level: 1.645 for 90%, 1.960 for 95%, 2.576 for 99%.
  • σ, the standard deviation — more spread widens the interval.
  • n, the sample size — the √n in the denominator means bigger samples give narrower, more precise intervals.

A 95% confidence level does not mean a 95% probability that this particular interval holds the true mean — the interval either contains it or it does not. It means the method captures the true mean about 95% of the time across many samples.

Worked example

Take a sample mean of 2, a standard deviation σ = 1 and a sample size n = 100, at 95% confidence. The standard error is σ/√n = 1/10 = 0.1, so the margin of error is 1.96 × 0.1 = 0.196 and the interval is 2 ± 0.196 = (1.804, 2.196) — the OpenStax textbook example. Switch to 90% and the margin shrinks to 0.1645; switch to 99% and it grows to 0.2576, because higher confidence demands a wider net.

Frequently asked questions

What is a confidence interval?

It is a range of values, computed from a sample, that is likely to contain the true population value. A 95% confidence interval for a mean gives a lower and upper limit produced by a method that captures the true mean about 95% of the time.

What is the margin of error?

The margin of error is the half-width of the interval, E = z·σ/√n — the amount added to and subtracted from the sample mean. A margin of ±0.196 means the interval extends 0.196 on each side of the mean.

Which z-value goes with each confidence level?

For a two-sided interval the standard critical values are 1.645 for 90%, 1.960 for 95% and 2.576 for 99%. Higher confidence needs a larger z, which widens the interval — the price of being more certain the true mean is inside.

Does a 95% interval mean a 95% chance the mean is inside?

No. The true mean is a fixed number; a given interval either contains it or it does not. The 95% refers to the long-run success rate of the procedure: if you repeated the sampling many times, about 95% of the intervals you built would contain the true mean.

When should I use a t-interval instead of this z-interval?

Use the z-interval when the population standard deviation is known or the sample is large. For a small sample with an unknown standard deviation, use the t-interval, which replaces z with a slightly larger t-value that depends on the degrees of freedom (n − 1). The two converge as the sample grows.

How do I make the interval narrower?

Collect a larger sample. Because n sits under a square root, quadrupling the sample size halves the margin of error. Lowering the confidence level also narrows the interval, but at the cost of being less sure it contains the true mean.