Confidence Interval & Z-Score Calculator
Computes a confidence interval for a mean as the sample mean plus or minus a critical value times the standard deviation over √n, with Student's t on n − 1 degrees of freedom when the deviation comes from the sample and z when σ is known. Proportions use the Wald margin z × √(p̂(1 − p̂) ÷ n), a population size adds the finite population correction, and a z-score is (x − μ) ÷ σ.
Pick the kind of figure you have. Mean mode turns a sample mean, its standard deviation and the sample size into a confidence interval for the population mean. Proportion mode does the same for a percentage, such as a poll result, and reports the margin of error in percentage points. Z-score mode places one value on a normal curve and gives the share of a normal population below and above it. The table sets your confidence level beside 90%, 95% and 99%, and an optional population size applies the finite population correction.
How the calculation works
Every interval here has the same shape: the estimate, plus or minus a critical value times a standard error. For a mean, NIST's Engineering Statistics Handbook gives
x̄ ± t × s ÷ √n
where x̄ is the sample mean, s the sample standard deviation, n the sample size and t the critical value of Student's t distribution with n − 1 degrees of freedom. When the population standard deviation σ is known rather than estimated, the handbook uses the standard normal critical value z instead, 1.9600 at 95%. The t value is always the larger of the two, because a standard deviation measured from the sample carries uncertainty of its own, and the gap closes as the sample grows: at 95%, t is 2.2622 for 10 observations and 1.9842 for 100.
For a proportion p̂ from n responses the standard error is √(p̂(1 − p̂) ÷ n), and the interval
p̂ ± z × √(p̂(1 − p̂) ÷ n)
is the normal-approximation, or Wald, interval behind a poll's "plus or minus 3 points". A z-score measures how far a value lies from the mean in units of standard deviation,
z = (x − μ) ÷ σ
and the shares below and above it are Φ(z) and 1 − Φ(z), where Φ is the standard normal distribution function. When you enter a population size N, the standard error in either interval is multiplied by the finite population correction:
FPC = √((N − n) ÷ (N − 1))
The defaults, worked through
Mean mode opens with a sample mean of 50, a sample standard deviation of 10 and 100 observations. The standard error is 10 ÷ √100 = 1, Student's t with 99 degrees of freedom at 95% is 1.9842, and the margin of 1.98 puts the interval at 48.02 to 51.98. At 90% the margin shrinks to 1.66; at 99% it grows to 2.63. Had the 10 been a known population σ, z = 1.9600 would give 48.04 to 51.96.
Proportion mode opens with 52% of 1,000 respondents. The standard error is √(0.52 × 0.48 ÷ 1,000) = 0.0158, or 1.58 percentage points, and 1.9600 times that is a margin of 3.10 points, an interval from 48.90% to 55.10%.
Z-score mode opens with a value of 85 on a scale whose mean is 70 and standard deviation 10, so z = (85 − 70) ÷ 10 = 1.50. Φ(1.50) is 0.9332: 93.3% of a normal population falls below 85 and 6.7% above it, and the two-tailed p-value is 0.1336.
From de Moivre's curve to Neyman's intervals
The curve behind z began as a shortcut through binomial arithmetic. In November 1733 Abraham de Moivre privately gave some friends a seven-page Latin paper, Approximatio ad Summam Terminorum Binomii (a + b)ⁿ in Seriem expansi, on approximating sums of binomial terms. Helen M. Walker's edition of the paper calls it the first statement of the formula for the normal curve. Only two copies are known to survive, and de Moivre's own translation went into the 1738 second edition of The Doctrine of Chances.
Student's t came from small samples. William Sealy Gosset, a chemist with the Guinness brewery from 1899 who published as Student, introduced a statistic for testing the mean of a normal sample in "The Probable Error of a Mean", printed in Biometrika in 1908, and he called it z. Jeff Miller's Earliest Known Uses of Some of the Words of Mathematics explains that today's t is Student's z multiplied by √(n − 1), a form R. A. Fisher introduced because it fitted his theory of degrees of freedom; his Statistical Methods for Research Workers of 1925 made the tables generally available.
The modern theory of the interval, and its name, came from Jerzy Neyman. Miller credits him with the term in a 1934 paper in the Journal of the Royal Statistical Society, "On the Two Different Aspects of the Representative Method", where he proposed to call certain intervals "the confidence intervals" and named a number ε, chosen in advance, "the confidence coefficient". His 1937 paper in the Philosophical Transactions of the Royal Society, "Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability", opens on the problem every interval on this page answers: a population that cannot be studied exhaustively, known only through a sample drawn from it.
The everyday vocabulary has its own dates. Citing the Oxford English Dictionary, Miller finds "margin of error" in 1867, in Chambers's Journal, for the tolerance on silver coin, fixed at one pennyweight per pound troy, and the modern statistical sense in 1889, when the Journal of the American Medical Association wrote of a "limit of error" and an "error-margin". He traces "standard scores" to Frank McMurry's 1913 study of New York City's elementary schools, where the phrase meant standard achievements, and notes that Merriam-Webster's Collegiate Dictionary dates the term to 1928. His page on symbols adds that z, today most often the standard normal, has come into wide use in recent decades, particularly in the expression z score.
What a margin of error leaves out
Pew Research Center's 2016 guide to election polls gives the standard reading: a margin of plus or minus 3 points at 95% confidence means that if the same survey were fielded 100 times, the result should land within 3 points of the true population value 95 of those times. Its example is a simple random sample of 1,067 cases, which this calculator puts at 3.00 points for a 50% result. Weighting enlarges the margin through the design effect, which pollsters should account for when they report it. Subgroups have wider margins: about 160 Hispanic adults in a proportionate national sample carry about 8 points, 7.75 here. The lead between two candidates has generally about twice the margin of either one. And sampling error is only one source of error; question wording and respondents who are not candid also move results, in ways much harder to quantify.
Assumptions and choices
The t interval assumes roughly normal data. William Cochran's Sampling Techniques notes that the t distribution holds exactly only for normally distributed observations from an infinite population, that moderate departures from normality do not affect it greatly, and that small samples from very skewed distributions need special methods. Cochran suggests t for samples under 50; this calculator, like NIST, uses it whenever the standard deviation comes from the sample, and at 99 degrees of freedom t is only about 1% above z.
The finite population correction applies whenever you enter N. OpenStax's Introductory Business Statistics calls it appropriate when more than 5% of the population is sampled; Cochran says it can be ignored up to 5%, and for many purposes up to 10%, at the cost of overstating the standard error. He writes the factor with N where this calculator, like OpenStax, uses N − 1, the form he attributes to authors working with σ. He also flags a result many find hard to believe: with the same spread, a sample of 500 from 200,000 estimates a mean almost as precisely as 500 from 10,000; this calculator's factors are 0.9988 and 0.9747.
For proportions the calculator keeps the Wald interval, the margin polls report. NIST's handbook calls a method that can produce an impossible limit, such as a negative lower bound, an inferior approach, and gives the Wilson interval instead, recommended by Brown, Cai and DasGupta in 2001 and by Agresti and Coull in 1998. So when the sample holds 5 or fewer successes or failures, short of what OpenStax's Introductory Statistics requires, or a Wald limit leaves the 0% to 100% range, the explanation becomes a caution quoting the Wilson interval. For 2% of 100 people, Wald gives −0.74% to 4.74% and Wilson 0.55% to 7.00%.
The arithmetic follows published algorithms: W. J. Cody's ANORM routine for normal probabilities, M. J. Wichura's Algorithm AS 241 for normal quantiles, and, for t, root-finding on the regularized incomplete beta function of Abramowitz and Stegun's formula 26.7.1, with their expansion 26.7.5 above 2,000 degrees of freedom. Every entry in NIST's printed t table comes back to its three decimals.
Frequently asked questions
What is the difference between a confidence interval and a margin of error?
The margin of error is half the width of the interval: the critical value times the standard error. The interval is the estimate plus or minus that margin. A poll result of 52% from 1,000 people has a 95% margin of 3.10 percentage points, so its interval runs from 48.90% to 55.10%.
When should I use t instead of z?
Use t when the standard deviation was measured from the same sample, which is the usual case, and z when the population standard deviation is known from elsewhere. With 100 observations the 95% critical values are 1.9842 for t and 1.9600 for z, about 1% apart. With 10 observations t rises to 2.2622, about 15% above z, so the interval is that much wider.
What sample size gives a margin of error of 3 points?
About 1,067 for a proportion near 50% at 95% confidence, the figure Pew Research Center uses in its guide to poll margins; this calculator gives plus or minus 3.00 points for it. The margin shrinks with the square root of the sample size, so halving it to 1.50 points takes four times as many responses, 4,268.
What does a z-score of 1.5 mean?
The value sits 1.5 standard deviations above the mean. On a normal curve 93.3% of values fall below it and 6.7% above, which puts it near the 93rd percentile, and the two-tailed p-value is 0.1336. A z-score of minus 1.5 is the mirror image, with 6.7% of values below it.
Does a 95% confidence interval mean a 95% chance that the true value is inside it?
Not quite. The 95% describes the method: NIST's Engineering Statistics Handbook explains that if the same population were sampled repeatedly, the intervals would bracket the true value in approximately 95% of cases. Any single interval either contains the true value or misses it; the confidence belongs to the procedure.
When does the population size matter?
Only when the sample is a sizable share of the population. OpenStax applies the finite population correction once more than 5% of the population is sampled. Drawing 100 from 5,000 multiplies the standard error by 0.9900, while 500 from 200,000 barely changes it, at 0.9988.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2 Confidence Limits for the Mean, National Institute of Standards and Technology
- NIST/SEMATECH e-Handbook of Statistical Methods, 7.1.4 What are confidence intervals?, National Institute of Standards and Technology
- NIST/SEMATECH e-Handbook of Statistical Methods, 7.2.4.1 Confidence intervals (for a proportion), National Institute of Standards and Technology
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.6.7.2 Critical Values of the Student's t Distribution, National Institute of Standards and Technology
- 5 key things to know about the margin of error in election polls (Andrew Mercer), Pew Research Center, 2016
- Introductory Business Statistics, 7.4 Finite Population Correction Factor, OpenStax, Rice University, 2017
- Introductory Statistics 2e, 8.3 A Population Proportion, OpenStax, Rice University, 2023
- Sampling Techniques, third edition (W. G. Cochran), John Wiley & Sons, via Internet Archive, 1977
- Handbook of Mathematical Functions, 26.7 Student's t-Distribution (Abramowitz and Stegun), National Bureau of Standards, via the University of British Columbia, 1964
- Algorithm AS 241: The Percentage Points of the Normal Distribution (M. J. Wichura), StatLib, Carnegie Mellon University, 1988
- Algorithm 715: SPECFUN, including ANORM (W. J. Cody), Netlib, 1993
- On the Law of Normal Probability (A. de Moivre, 1733), edited by Helen M. Walker, History of Statistics, University of York
- Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability (J. Neyman), Philosophical Transactions of the Royal Society A, 1937
- Earliest Known Uses of Some of the Words of Mathematics (C): Confidence Interval (Jeff Miller), MacTutor History of Mathematics, University of St Andrews
- Earliest Known Uses of Some of the Words of Mathematics (S): Standard Score, Student's t-Distribution (Jeff Miller), MacTutor History of Mathematics, University of St Andrews
- Earliest Known Uses of Some of the Words of Mathematics (M): Margin of Error (Jeff Miller), MacTutor History of Mathematics, University of St Andrews
- Earliest Uses of Symbols in Probability and Statistics (Jeff Miller), MacTutor History of Mathematics, University of St Andrews
- William Sealy Gosset (biography), MacTutor History of Mathematics, University of St Andrews, 2003