Confidence Interval Calculator - Mean, Proportion and Wilson

    Find the range a true mean or rate most likely falls in, from raw data, a mean with its SD, or a count. Wilson, exact and Wald intervals side by side, one-sided bounds and a small-population correction.

    Parameters

    Enter data for calculations

    Only the boxes for your choice appear

    Leave empty for a large population

    Higher level, wider interval

    Decide it before you see the data

    Form progress0 / 3 fields

    💡 Fill in all required fields to unlock the calculate button

    Confidence intervals for a mean or a proportion, with four methods side by side

    Two successes out of 20 is a rate of 10%, yet the 95% range for the true rate runs from 2.79% to 30.10%, and the textbook plus-or-minus formula would have cut it off at 23.15%. This confidence interval calculator works from raw measurements, from a mean with its standard deviation and sample size, or from a count of successes. Means get Student's t interval; proportions get the Wilson score interval as the headline, with the exact Clopper-Pearson, Agresti-Coull and Wald intervals printed underneath so you can see where they disagree. You can ask for a two-sided interval or a one-sided bound, choose from five confidence levels, and correct for a small population, such as a survey of 400 people out of 1,000.

    1.960
    critical z behind a two-sided 95% interval
    4 ×
    the sample needed to halve a margin of error
    3 / n
    the rule of three for zero events in n trials

    Six choices before the interval appears

    1. What you have - raw measurements, a finished mean with its standard deviation and sample size (as printed in a report or a paper), or a count of successes out of a sample for a proportion. Before a poll, the sample size alone gives the margin of error it will report: ±9.80 points for 100 people, ±3.10 for 1,000.
    2. The data - paste the measurements separated by spaces, commas or new lines, with a dot for decimals; or type the mean, the sample standard deviation (the n - 1 kind) and n; or type the successes and the sample size.
    3. Population size (optional) - fill it in only when the sample is a noticeable share of a finite group, for example 400 employees surveyed out of 1,000. Left empty, the population is treated as unlimited.
    4. Confidence level - 80%, 90%, 95%, 98% or 99%. Nothing is preselected, because the level alone decides how wide the interval is.
    5. Kind of interval - two-sided, or a single lower or upper bound when only one direction matters, such as "the failure rate is at most".
    6. Read the result: the interval, the margin of error, the standard error and critical value, the method comparison for proportions, and the same data at all five confidence levels.

    What a confidence interval does and does not promise

    A confidence interval is an estimate with its uncertainty attached: a range of values for a population quantity, such as the average weight of a product or the share of voters who back a candidate, built from one random sample. The width comes from two things, the standard error of the estimate and a critical value that depends on the confidence level. For a mean that is x̄ ± t × s / √n; for a proportion the simplest version is p ± z × √(p(1 - p) / n).

    The word confidence describes the method, not the one interval you are looking at. If you drew sample after sample and built a 95% interval each time, about 95% of those intervals would contain the true value. The interval from your sample either contains it or does not; you just cannot tell which. That is also why a 99% interval is wider than a 95% one from the same data: more coverage costs width, and the calculator prints all five levels so the trade is easy to see.

    Two quiet assumptions sit under every row of the result. The sample has to be random and the observations independent. An online poll that only reaches people who choose to answer, or twenty measurements taken from the same batch, breaks the first or the second, and no formula repairs that. The margin of error covers sampling luck only.

    Four ways to put an interval around a proportion

    For proportions there is no single standard method, and the choice matters most when the count is small or the rate sits near 0% or 100%. The table lists the four the calculator prints, how each is built and where it goes wrong. The comparison follows Brown, Cai and DasGupta's review in Statistical Science, which recommends Wilson for small samples and warns against Wald.

    Method How it is built Behavior Where you meet it
    Wilson score inverts the z-test, so the center shifts toward 50% coverage close to the nominal level, never outside 0-100% the headline here; R prop.test prints it with a continuity correction
    Clopper-Pearson exact binomial tails, solved with the beta distribution never undercovers, but is the widest of the four R binom.test, regulatory and quality reports
    Agresti-Coull adds z²/2 successes and z²/2 failures, then uses the plain formula close to Wilson, a little wider near the edges introductory courses, the "add two and two" rule
    Wald p ± z × √(p(1 - p) / n) collapses to a point at 0 or n successes, undercovers small samples most textbooks and the margin of error quoted in news polls

    Critical values of t and z at 90%, 95% and 99%

    For a mean, the critical value comes from Student's t with n - 1 degrees of freedom, because the standard deviation is estimated from the same sample. The table shows how quickly t shrinks toward the normal value as the sample grows. These are two-sided values; a one-sided 95% bound uses the 90% column.

    Degrees of freedom 90% 95% 99%
    16.31412.70663.657
    22.9204.3039.925
    52.0152.5714.032
    101.8122.2283.169
    201.7252.0862.845
    301.6972.0422.750
    601.6712.0002.660
    1201.6581.9802.617
    normal (z)1.6451.9602.576

    Seven samples and the intervals they produce

    Five measurements. 12, 14, 15, 13 and 16 at 95%: mean 14.00, standard error 0.707, critical t 2.776 on 4 degrees of freedom.
    Interval: 12.04 to 15.96, margin ±1.96.
    Eight body temperatures. 98.6, 98.2, 97.9, 99.1, 98.4, 98.8, 97.7 and 98.3 °F at 90%: mean 98.375, standard deviation 0.45904, critical t 1.895.
    Interval: 98.068 to 98.682 °F, margin ±0.307.
    A mean from a report. Mean 3,450, SD 620, n = 40 at 95%: standard error 98.0, critical t 2.023. A one-sided 95% upper bound for the same data is at most 3,615.
    Interval: 3,252 to 3,648, margin ±198.
    A poll. 300 of 1,000 respondents at 95%. Clopper-Pearson gives 27.17% to 32.95% and Wald 27.16% to 32.84%; at this size the methods agree to a fraction of a point.
    Wilson: 27.24% to 32.91%, margin ±2.84 points.
    A small pilot. 2 of 20 at 95%. Wald stops at 0.00% to 23.15%; the exact interval is 1.23% to 31.70%. The Wilson range reaches 7.21 points below the sample rate and 20.10 above it.
    Wilson: 2.79% to 30.10%.
    Staff survey, finite population. 200 of 400 employees answered yes, out of a workforce of 1,000. The correction factor is 0.7750; without it the interval would be 45.12% to 54.88%.
    Wilson with the correction: 46.21% to 53.79%, margin ±3.79 instead of ±4.88.
    Zero defects. 0 of 20 parts failed. Wald returns a range of zero width; the exact one-sided 95% upper bound is 13.91%, near the rule-of-three estimate of 3/20 = 15%.
    Wilson, two-sided 95%: 0.00% to 16.11%.

    Four regularities behind every interval

    Width follows the square root of n. Doubling the sample narrows the interval by only about 29%, because the standard error falls with √n. To halve a margin of error you need four times the observations, which is why polls rarely go far beyond 1,000 people.
    A proportion near 50% is the hardest to pin down. The factor p(1 - p) peaks at 0.25 when p is one half. The same 400 responses give a Wilson margin of ±4.88 points at 50%, and a much tighter one for a rate near 10%.
    Near the edges, intervals stop being symmetric. A rate of 10% from 20 observations cannot swing 20 points down, so a good method stretches upward instead. That is why the calculator prints the distance to each bound separately when they differ, rather than a single plus-or-minus.
    Beyond about 200 observations t and z agree. At 199 degrees of freedom the two-sided 95% t is 1.972 against 1.960 for z, a difference of well under 1% in the width.

    Reading the result you get

    What you see What it means
    A narrow intervalthe sample pins the value down, provided it was random
    A wide intervalmore data needed before reading much into the estimate
    A reference value outside the intervala two-sided test at the matching level would reject it
    Two groups whose intervals overlapnot proof of no difference; compare them with a two-sample test instead
    Wald very different from Wilsonthe count is too small for the plus-or-minus formula; trust Wilson or the exact row

    The intervals describe sampling error in a random sample. They say nothing about measurement bias, non-response or a badly worded question.

    Confidence interval questions, with the numbers

    Is there a 95% chance that the true value is inside my 95% interval?
    Not in the usual sense. The 95% is the long-run hit rate of the method across repeated samples. Once your interval is computed, the true value is either in it or not. Saying "we are 95% confident" is the accepted shorthand for that property of the procedure.
    Why is my interval for a percentage not centered on the percentage?
    The Wilson method pulls the center toward 50%, and the pull is strong when the sample is small or the rate is extreme. With 2 of 20 the interval runs from 2.79% to 30.10% around a rate of 10%. A symmetric range would have to dip below zero, which is impossible for a proportion.
    When should a mean use z instead of t?
    Only when the population standard deviation is known in advance, which is rare outside quality control and standardized tests. With a standard deviation estimated from the sample, t is the correct choice at every size; beyond about 200 observations the two agree so closely (1.972 against 1.960) that it no longer matters.
    Which interval do Excel and R print?
    Excel's CONFIDENCE.T returns only the margin of error, t times s over the square root of n, and CONFIDENCE.NORM the same with z. In R, t.test prints the t interval for a mean, prop.test a Wilson interval with a continuity correction (a little wider than the plain Wilson row here), and binom.test the exact Clopper-Pearson interval.
    What does the population size box change?
    It applies the finite population correction, a factor of √((N - n) / (N - 1)) on the standard error. It barely matters when the sample is under about 5% of the population, but for 400 people out of 1,000 it is 0.7750, and the margin drops from ±4.88 to ±3.79 points. The exact Clopper-Pearson row ignores it.
    How many responses give a margin of error of 3 points?
    At 95% confidence and a proportion near 50%, 1,068 responses, from 1.96² × 0.25 / 0.03² rounded up. This calculator reads an interval off data you already have; the planning question belongs to the sample size calculator linked below.
    When is a one-sided bound the right choice?
    When only one direction has consequences and that was decided before looking at the data, as in "the defect rate is at most" or "the mean fill is at least". A one-sided 95% bound uses the same critical value as a two-sided 90% interval, so it sits closer to the estimate: for the report example, at most 3,615 against a two-sided upper end of 3,648.

    Related tools

    Standard Error Calculator

    The standard error behind every interval, and the standard deviation recovered from a published interval - See calculator

    Grouped Data Quartile Calculator

    Quartiles, the median and percentiles when the data come as a frequency table - See calculator

    Sample Size Calculator

    Works backward from the margin of error you want to the number of responses you need - See calculator

    One-Sample T-Test Calculator

    Tests a mean against a fixed value using the same standard error and t distribution - See calculator

    Z-Test Calculator

    Compares two conversion rates or a rate with a benchmark, with a p-value and the traffic needed - See calculator

    Two-Sample T-Test Calculator

    The right tool when two intervals overlap and you want to know whether the means really differ - See calculator

    P-Value Calculator

    Turns a z, t, chi-square or F statistic into an exact p-value, with critical values at the usual alpha levels - See calculator

    Standard Deviation Calculator

    Computes the sample and population standard deviation that feeds the interval for a mean - See calculator

    Similar calculators from this section