Confidence Interval Calculator

Mean ± margin of error at 80–99% confidence.

Free confidence interval calculator for a sample mean. Enter the mean, standard deviation, sample size and confidence level to get the interval and margin of error. Runs entirely in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How is the confidence interval calculated?

It uses the z-based formula mean ± z × (σ / √n), where z is the critical value for your chosen confidence level. For 95% confidence z is 1.96.

A confidence interval is a range, built from sample data, that is likely to contain the true population mean. This calculator computes a z-based interval from your sample mean, standard deviation, sample size and chosen confidence level. It is a staple of statistics coursework, survey analysis and A/B testing, where you want to report not just an estimate but how precise it is.

How it works

The interval is the sample mean plus and minus a margin of error:

CI = mean ± z × (σ ÷ √n)

Here σ ÷ √n is the standard error of the mean, and z is the critical value for your confidence level. The tool uses these z values: 80% → 1.282, 90% → 1.645, 95% → 1.960, 98% → 2.326, 99% → 2.576. A higher confidence level uses a larger z, widening the interval; a larger sample size shrinks the standard error, narrowing it.

Example

Sample mean 100, standard deviation 15, sample size 36, at 95% confidence:

standard error = 15 ÷ √36 = 15 ÷ 6 = 2.5 margin = 1.96 × 2.5 = 4.9 interval = 100 ± 4.9 = 95.1 to 104.9

So you can be 95% confident the true mean lies between 95.1 and 104.9. All maths happens locally in your browser.

What “95% confident” actually means

The phrasing “I am 95% confident the true mean lies between X and Y” is commonly used but subtly misunderstood. The correct interpretation: if you repeated the sampling process many times and built a confidence interval from each sample using the same method, about 95% of those intervals would contain the true population mean. The current interval either contains the true mean or it doesn’t — we just don’t know which.

This is different from saying “there is a 95% probability the true mean is in this interval.” Once you have collected data and computed the interval, it is a fixed range; the 95% refers to the long-run frequency of the procedure, not the probability for this particular result.

How confidence level affects the interval

Increasing the confidence level widens the interval because you need to be more sure the range captures the true mean. For the same data as above (mean 100, σ 15, n 36):

Confidence levelz valueMargin of errorInterval
80%1.2823.2196.8 to 103.2
90%1.6454.1195.9 to 104.1
95%1.9604.9095.1 to 104.9
99%2.5766.4493.6 to 106.4

The 99% interval is about twice as wide as the 80% interval. Practically: for publication-quality research, 95% is the standard; for preliminary analysis or internal decisions, 90% may be acceptable; for safety-critical estimates where you want to be very cautious, 99%.

How sample size affects precision

The margin of error is z × σ / √n. To halve the margin of error, you need to quadruple the sample size, because the denominator only grows as the square root of n. This relationship explains why large surveys produce narrow, precise intervals — and why small pilot studies produce wide, uncertain ones that should not be over-interpreted.

z vs. t intervals

This tool uses the z critical value, which is appropriate when the population standard deviation is known or when the sample is large (roughly n ≥ 30). For small samples where you are estimating σ from the sample, a t-interval uses the t-distribution with n − 1 degrees of freedom, producing slightly wider intervals to account for the extra uncertainty in estimating σ. For large samples the t and z values converge and the difference is negligible.