Confidence Interval Calculator

Four numbers in — sample size, mean, standard deviation and confidence level — and the interval your population mean most likely sits in comes back out.

CI Just enter your values below — results update automatically.
Your sample

Four numbers describing your sample. If you have the raw readings instead, run them through the standard deviation calculator first.

Confidence interval
—
Fill in all four values
The working, step by step
Your sample at other confidence levels

How this calculator works

Give it four numbers — how many observations you have, their average, their standard deviation, and how confident you want to be — and it returns the range your population mean most plausibly sits in, together with the half-width of that range.

The working is shown rather than hidden, because the margin of error is a short chain of three steps and seeing it makes the result checkable. The error bar underneath draws the same interval to scale, which is the quickest way to notice when an interval is far wider than the question can tolerate.

standard error  =  s ÷ √n
margin of error  =  z × standard error
interval  =  x̄ ± margin of error

What a confidence interval really says

A sample average is a guess at a population average, and like any guess it deserves a stated uncertainty. The interval is that statement: not a single number, but a range together with how often a range built this way would be right.

The phrasing matters more here than in most of statistics. A 95% interval does not mean the true mean has a 95% chance of lying inside the one you are looking at. The population mean is a fixed quantity; it is in or it is out, and no probability attaches to it. What is random is your sample, and therefore the interval. Run the study a hundred times and about ninety-five of the hundred intervals you produce would capture the true value.

That distinction sounds pedantic until it changes a decision. "Ninety-five percent sure the mean is above 20" is a claim about a fixed number and is not what the interval licenses. "A method that is right ninety-five times in a hundred puts the mean above 20" is the honest version, and it is the one a careful reader will hold you to.

The formula, piece by piece

Three quantities combine, and each has a plain meaning.

PieceWhat it isEffect on the interval
sSpread of the individual observationsMore spread, wider interval
√nSquare root of the sample sizeMore data, narrower interval
s ÷ √nStandard error: spread of the averageThe unit the margin is measured in
zHow many standard errors to reachHigher confidence, wider interval

The standard error is the step worth pausing on. It is not how much the individual readings vary — that is s — but how much the average of n readings would vary if you drew the sample again. Averages are steadier than the things they average, and the square root of n is exactly how much steadier.

Working the page's starting figures through gives a concrete sense of scale:

n = 64,  x̄ = 48.2,  s = 7.5,  level = 95%
standard error  =  7.5 ÷ √64  =  0.9375
margin  =  1.9600 × 0.9375  =  1.8375
interval  =  48.2 ± 1.837  =  [46.363, 50.037]

Where the z value comes from

The z value answers one question: how many standard errors either side of the average do you have to reach to enclose the chosen share of a normal distribution? For 95% the answer is 1.96, a number worth memorising because it turns up everywhere.

Confidence levelz valueMargin on the example above
80%1.2816±1.201
90%1.6449±1.542
95%1.9600±1.837
98%2.3263±2.181
99%2.5758±2.415
99.9%3.2905±3.085

Any level between 0 and 100 works here, not only the familiar ones, because the z value is computed from the normal distribution rather than read from a short table. Notice how slowly the margin grows against how fast the confidence does: going from 95% to 99% buys four percentage points of confidence for about a third more width, while 99% to 99.9% costs another 28% of width for nine tenths of a point.

Choosing a confidence level

Ninety-five percent is the default across most fields, and the reason is convention rather than mathematics. It is a reasonable balance for ordinary work, and using it means your interval can be compared with everyone else's without a footnote.

Depart from it when the cost of being wrong is unusual. Drug trials and safety work routinely use 99% or higher, because a miss is expensive and the extra data is worth buying. Early exploratory work sometimes uses 90%, on the grounds that a narrower interval guiding the next experiment beats a wide one that rules nothing out. What you should not do is compute several levels and report whichever supports the conclusion you wanted — pick the level before you look.

Why sample size matters more than anything

Of the three inputs you control, sample size is the only one that reliably narrows the interval. The standard deviation belongs to the thing being measured, and the confidence level only trades width for certainty. Adding data genuinely buys precision.

It buys it slowly, though, because n sits under a square root. Halving the margin of error takes four times the sample:

Sample sizeStandard error95% margin
251.500±2.940
1000.750±1.470
4000.375±0.735
1,6000.188±0.367

That square root is why survey sample sizes plateau around a thousand or two. Going further is not wrong, it simply stops being worth the money. If you are planning a study rather than analysing one, our sample size calculator runs this backwards from the margin you want.

z against t, and the 30 rule

Strictly, z applies when the population standard deviation is known and t applies when it is estimated from the sample — which, in practice, is nearly always. The t value is slightly larger, widening the interval to pay for that extra uncertainty.

The gap closes as the sample grows, and somewhere around 30 observations it stops mattering for most purposes. That is where the familiar rule of thumb comes from, and why this page shows a note below 30 rather than silently handing back a figure that is too narrow:

Sample sizez at 95%t at 95%Difference
51.9602.77642% wider
101.9602.26215% wider
301.9602.0454% wider
1001.9601.9841% wider

With a small sample and an estimated standard deviation, a z-based interval is optimistic. The honest reading of a result below 30 here is that the true interval is somewhat wider than the one shown.

Edge cases and common mistakes

  • Reading it as a probability about the mean. Covered above, and worth the repetition because it is the error that survives a statistics course.
  • Confusing the interval with the data's range. The interval describes where the average might be, not where individual observations fall. It is far narrower than the data, and it is meant to be.
  • Using it on a proportion. Percentages have their own standard error. Feeding a proportion in as a mean gives a number with no meaning.
  • A standard deviation of zero. Every observation identical gives no basis for inference at all, so it is refused rather than returning a zero-width interval.
  • Overlapping intervals. Two intervals that overlap do not prove the two means are equal, and two that do not overlap are stronger evidence than a formal test requires. Compare groups with a test designed for it, not by eye.

What this page does not do

It handles the confidence interval for a single mean using the z distribution. It does not do intervals for proportions, for the difference between two means, for variances, or for regression coefficients, and it does not perform hypothesis tests. It assumes you already have the mean and standard deviation — if you have raw numbers instead, our standard deviation calculator produces both from a list, and the statistics calculator gives the full set of descriptive figures.

The arithmetic runs locally in your browser. No sample figures leave the page, which also means it keeps working with the network switched off.

Frequently asked questions

What does a 95% confidence interval actually mean?

It describes the method, not the one interval in front of you. If you repeated the whole study many times and built an interval each time the same way, about 95 of every 100 of those intervals would contain the true population mean. The interval you have either contains it or does not.

Is there a 95% chance the true mean is inside my interval?

No, and this is the most common misreading of the whole subject. The population mean is a fixed number, not a random one, so it does not have a probability of being anywhere. The randomness lives in your sample, and therefore in the interval, not in the parameter.

What is the margin of error?

It is the half-width of the interval — the plus-or-minus figure. It is the z value for your confidence level multiplied by the standard error, which is the standard deviation divided by the square root of the sample size.

How do I make my interval narrower?

Collect a larger sample, which is the lever that works reliably. Because the sample size sits under a square root, cutting the margin in half takes four times the data. Accepting a lower confidence level also narrows it, but you buy that width with certainty.

Should I use z or t?

Strictly, z when the population standard deviation is known and t when it is estimated from the sample. This page uses z, matching the standard references. Past about 30 observations the two agree closely; below that the t value is noticeably larger and a z-based interval comes out too narrow.

Why does the page warn me below 30 observations?

Because the method leans on the sample mean being roughly normally distributed, which small samples do not guarantee, and because the z value genuinely understates the margin there. The result is still shown, with the caveat attached.

Can I use this for a percentage or a proportion?

Not directly. A proportion has its own standard error, the square root of p times one minus p over n, rather than a separate standard deviation. This page is built for the mean of a measured quantity.

This calculator is provided for general educational and analytical use and is not a substitute for advice from a qualified statistician. Results depend on assumptions about your data — chiefly that the sample is random and the sample mean is approximately normally distributed — that the calculator cannot check for you. See our about page for how these tools are built and tested, and our privacy policy for what we do and do not collect.