Confidence Interval Calculator

Enter your sample mean, standard deviation, and sample size, then pick a confidence level. You'll get the confidence interval for the population mean, plus the margin of error and standard error.

Put this calculator on your website for free

Copy one snippet and give your visitors a working Confidence Interval Calculator.

A sample mean shown as a point with a confidence interval extending equally either side, labelled as the margin of error sample mean lower upper margin of error a wider interval means less precision, not a worse estimate
The interval is symmetric around your sample mean, and its half-width is the margin of error. Precision improves with the square root of the sample size, so quadrupling n only halves the width.

How the confidence interval calculator works

A sample mean is your best single guess at the population mean, but it's almost never exactly right; a different random sample would have given a slightly different average. A confidence interval turns that single guess into an honest range. The calculator finds the standard error (how much sample means typically wobble), multiplies it by a z-value that matches your chosen confidence level, and stretches that margin of error on either side of your sample mean.

The formula

CI = x̄ ± z × ( s ÷ √n )

Here x̄ is the sample mean, s is the sample standard deviation, n is the sample size, and z is the critical value for your confidence level: 1.645 for 90%, 1.960 for 95%, and 2.576 for 99%. The quantity s ÷ √n is the standard error, and z × (s ÷ √n) is the margin of error.

Worked example

You test 36 students and find a mean score of 100 with a standard deviation of 15, and you want 95% confidence:

Standard error = 15 ÷ √36 = 15 ÷ 6 = 2.5

Margin of error = 1.960 × 2.5 = 4.9

CI = 100 ± 4.9 = 95.1 to 104.9. You can be 95% confident (in the repeated-sampling sense) that the true average score of the whole population lies in that range.

What "95% confident" does (and doesn't) mean

The most common misreading of a confidence interval is "there's a 95% chance the true mean is between 95.1 and 104.9." Strictly, that's wrong: the true mean is a fixed (if unknown) number, so it's either in the interval or it isn't. The 95% describes the method: build intervals this way from repeated random samples, and about 95 in 100 of them will capture the truth. Your interval is one draw from that process. Two practical notes: this calculator uses z-values, which is standard practice and accurate for n ≥ 30; for small samples, a t-distribution gives slightly wider intervals that account for the extra uncertainty in estimating s. And the interval only covers sampling error: a biased sample (surveying only your happiest customers, say) produces a beautifully precise interval around the wrong answer.

Frequently asked questions

What does a 95% confidence interval actually mean?

It means the procedure works 95% of the time: if you repeated your sampling over and over and built an interval each time, about 95% of those intervals would contain the true population mean. It does not mean there's a 95% probability the true mean is inside this particular interval; the true mean is a fixed number, not a random one.

How do I make my confidence interval narrower?

Three levers: collect a bigger sample (the margin of error shrinks with the square root of n, so quadrupling the sample halves the interval), accept a lower confidence level (90% is narrower than 99%), or reduce measurement noise so the standard deviation is smaller.

What z-values go with each confidence level?

The standard multipliers are 1.645 for 90% confidence, 1.960 for 95%, and 2.576 for 99%. These come from the standard normal distribution: for example, 95% of the distribution lies within 1.96 standard deviations of the mean.

When should I use a t-distribution instead of z?

When your sample is small (under about 30) and you're estimating the standard deviation from the sample itself, the t-distribution gives slightly wider, more honest intervals. Above n = 30 the two are nearly identical, so the z-based interval this calculator produces is a fine approximation.

What is the margin of error?

It's the half-width of the confidence interval, the amount you add to and subtract from the sample mean. It equals the z-value times the standard error (standard deviation divided by the square root of the sample size). A poll reported as "52% ± 3%" is quoting a margin of error of 3 percentage points.

Related calculators