Quick answer: The margin of error formula is MOE = z × √(p(1 − p) / n). At 95% confidence (z = 1.960) with a proportion of 0.5 and a sample of 1,000, the margin of error is 1.960 × √(0.25 / 1,000) = 3.10%. Run the formula backwards and a target margin of 3% at 95% confidence requires 1,068 responses. Enter your own sample size, confidence level and proportion above and this margin of error calculator returns the margin, the confidence interval around your result, and — in its second mode — the sample size any target margin requires.
How to use this margin of error calculator
Step 1 — Pick the mode that matches your question. The calculator works in two directions. The first mode finds the margin of error from a sample size: you supply the sample size n, a confidence level and the proportion p, and it returns the margin together with the confidence interval for that proportion. The second mode is the sample size calculator margin of error direction: you supply a target margin, a confidence level and an expected proportion, and it returns the number of responses you need to collect, always rounded up.
Step 2 — Set the confidence level and the proportion honestly. The confidence level sets the z-value — 1.645 at 90%, 1.960 at 95% and 2.576 at 99% — and 95% is the standard choice for published work. The proportion is the share you observed, or expect, as a percentage. If you are planning and cannot know the result in advance, leave it at 50%: p = 0.5 maximises p(1 − p) and gives the largest, safest margin and sample size.
Step 3 — Add a population size only when it earns its place. Leave the population field empty for national polls and any population in the hundreds of thousands or more: the correction it drives is effectively 1 and changes nothing. Enter it when you sampled a noticeable share of a small, known population — 1,000 employees out of a company of 4,000 — and the finite population correction will tighten the margin to reflect how much of the whole you actually measured.
What margin of error is — and what it is not
In short: the margin of error is the plus-or-minus amount attached to a result that comes from a sample rather than from measuring everyone. A poll that reports a candidate on 52% with a margin of error of ±3.10% is saying: we asked 1,000 people rather than the whole electorate, and because of that sampling alone, the true figure plausibly sits somewhere between 48.90% and 55.10%. The margin exists because a different sample of the same size, drawn the same way, would have given a slightly different answer — and the formula quantifies how different it could reasonably be.
Two clarifications prevent most misreadings. First, the margin is not a guarantee or a hard boundary: at 95% confidence, the interval built from it captures the true value in about 95 of every 100 repeated samples — about 5 in 100 miss it, by design. Second, the margin applies to the proportion it was computed from: a subgroup inside the same poll rests on a smaller n and carries a larger margin. A poll of 1,000 might rest its youngest subgroup on 120 respondents, whose margin is nearer ±8.95% — quoting the headline margin for a subgroup figure is one of the most common errors in survey reporting.
Above all, the margin is not a measure of total survey quality. It prices exactly one thing — random sampling error, under the assumption of a simple random sample — and the honest-limits section lists everything else that can move a real survey's result.
The margin of error formula, step by step
The formula: MOE = z × √(p(1 − p) / n). Each part does one job. The term under the square root is the variance of a sample proportion: a proportion near 0.5 varies most from sample to sample, which is why p(1 − p) peaks at p = 0.5 with a value of 0.25, and falls to 0.21 at p = 0.3 or 0.7 and to 0.09 at p = 0.1 or 0.9. Dividing by n and taking the square root gives the standard error — the typical distance between a sample proportion and the true proportion, in proportion units. Multiplying by z then stretches that typical distance into the distance you need for your chosen confidence level: about 1.645 standard errors for 90% confidence, 1.960 for 95%, and 2.576 for 99%.
Worked through once, slowly, for the pre-filled example: n = 1,000, p = 0.5, 95% confidence. First p(1 − p) = 0.5 × 0.5 = 0.25. Divide by n: 0.25 / 1,000 = 0.00025. Take the square root: √0.00025 = 0.01581 — that is the standard error, about 1.58 percentage points. Multiply by z = 1.960: 0.01581 × 1.960 = 0.0310. Expressed as a percentage, the margin of error is 3.10%. Every figure this calculator shows is produced by exactly those four steps, with one optional fifth: when you supply a population size N, the result is multiplied by the finite population correction √((N − n) / (N − 1)), explained in its own section below.
The same formula explains two facts that surprise people. Because n sits under a square root, precision is expensive: halving the margin requires four times the sample, not twice. And because z grows as confidence rises, certainty is expensive too: moving from 95% to 99% confidence widens every margin by a factor of about 1.31, at any sample size.
Worked examples you can check by hand
Four examples pin the calculator down, and every one of them can be reproduced with a pencil or a spreadsheet. Example 1: n = 1,000, 95% confidence, p = 0.5 gives a margin of error of 3.10%, as worked step by step in the formula section above. If the observed result were 52%, the confidence interval would run from 48.90% to 55.10%. Example 2: keep everything the same but add a population of N = 10,000. The finite population correction is √((10,000 − 1,000) / (10,000 − 1)) = √(9,000 / 9,999) = 0.9487, and the margin tightens to 3.10% × 0.9487 = 2.94%. Sampling a tenth of the whole population genuinely does tell you more, and the correction is the size of that extra knowledge.
Example 3 runs the formula backwards, the way survey planners actually use it. A target margin of 3% at 95% confidence with p = 0.5 requires n = z² × p(1 − p) / MOE² = 1.960² × 0.25 / 0.03² = 3.8416 × 0.25 / 0.0009 = 1,067.07 — and because a fractional respondent does not exist and rounding down would miss the target, the answer is rounded up to 1,068 responses. Example 4 raises the confidence level instead: n = 500 at 99% confidence with p = 0.5 gives 2.576 × √(0.25 / 500) = 2.576 × 0.02236 = 5.76%. Compare it with the same sample at 95%, which gives 4.38%, and the cost of the stronger guarantee is right there in the two numbers. Run all four examples in the calculator above and each figure is reproduced exactly, which is the honest way to decide whether to trust a tool with your real survey.
Confidence levels and z-values: 90%, 95% or 99%
The confidence level is a promise about the method, not about any single result. A 95% level means that if the same survey were repeated many times, about 95% of the intervals built the same way would contain the true population value. It does not mean there is a 95% probability that this one interval contains it — for the interval you computed, the true value is either inside or outside, and the 95% describes how trustworthy the procedure is. That is exactly where the everyday phrase “19 times out of 20” comes from.
In practice the choice is a trade. At 90% confidence (z = 1.645) intervals are narrowest and one in ten misses — acceptable where a wrong call is cheap. At 95% (z = 1.960) the procedure misses one time in twenty, and the level is the default for published polling, academic reporting and this calculator. At 99% (z = 2.576) only one interval in a hundred misses, but every margin grows by about 31% over its 95% value at the same n. Choose the level before you look at the result, and report it alongside the margin every time: a margin quoted without its confidence level is only half a figure. The z-values come from the standard normal distribution — the curve the Z-Score Calculator works with — and tail probabilities for test statistics are the job of the P-Value Calculator.
Finding the required sample size
Planning runs the formula in reverse: squaring and rearranging gives n = z² × p(1 − p) / MOE², with MOE entered as a decimal. Two rules govern its use. First, always round up: 1,067.07 respondents means 1,068, because 1,067 would deliver a margin fractionally wider than promised. Second, plan with p = 0.5 unless you have strong prior evidence for a different value — if the true proportion lands nearer 0.5 than expected, a sample sized for p = 0.2 will miss its target margin.
The landmarks are worth memorising, because they recur in every methods course and every polling story. At 95% confidence with p = 0.5: a ±5% margin needs 385 responses, ±4% needs 601, ±3% needs 1,068, ±2% needs 2,401 and ±1% needs 9,604. Read the pattern and the square-root law is unmistakable — each halving of the target margin roughly quadruples the fieldwork. When a population size is supplied, the second mode applies the finite population correction to the requirement as well: n is divided by 1 + (n − 1) / N before rounding up, which is why surveying 400 staff in a firm of 600 needs far fewer than 385 completed responses for a ±5% reading. For the variability of measured quantities rather than proportions — the planning cousin of this calculation — see the Standard Deviation Calculator, and for chance calculations generally the Probability Calculator.
The finite population correction
The basic formula quietly assumes the population is so large that sampling barely dents it — that drawing one respondent leaves the pool effectively unchanged. When that assumption fails, the standard error overstates the uncertainty, because a sample that covers a tenth of everyone plainly knows more than a sample that covers a millionth. The finite population correction, FPC = √((N − n) / (N − 1)), is the adjustment that credits it. It equals 1 when n is tiny next to N, falls as the sampled share grows, and reaches 0 in the limiting case where the sample is the entire population — a census, which has no sampling error at all.
A working rule: apply the correction whenever the sample exceeds about 5% of the population. Below that share most published polls ignore it safely. Above it, the effect is real: the worked example on this page, 1,000 from 10,000 at 95%, tightens from 3.10% to 2.94%, and an employee survey reaching 500 of a 600-person company reports not ±4.38% but about ±1.79%. This calculator applies the correction in both modes, so a small-population plan is not over-bought out of caution.
Margin of error at common sample sizes
The table below is computed from the same formula this calculator uses — 95% confidence, p = 0.5, no population correction — and every row can be reproduced above by entering the sample size. It is the fastest way to develop a feel for what a sample size buys, and to sanity-check any margin quoted to you: if a survey of 400 claims a margin of ±2%, something other than this formula produced that claim.
| Sample size (n) | Margin of error at 95% | What it is typically used for |
|---|---|---|
| 50 | 13.86% | A classroom exercise or a quick pilot |
| 100 | 9.80% | A small internal survey |
| 200 | 6.93% | A local or single-site survey |
| 300 | 5.66% | A small regional poll |
| 400 | 4.90% | The classic ±5% planning point (385 exactly) |
| 500 | 4.38% | A mid-size published poll |
| 750 | 3.58% | A larger regional poll |
| 1,000 | 3.10% | The standard national poll size |
| 1,500 | 2.53% | A national poll with subgroup reporting |
| 2,000 | 2.19% | A large national poll |
| 2,500 | 1.96% | Tracking polls near an election |
| 5,000 | 1.39% | Government and academic surveys |
| 10,000 | 0.98% | Very large official surveys |
Read the table from the cost side too. Doubling the fieldwork from 1,000 to 2,000 respondents buys less than one percentage point of margin, from 3.10% to 2.19%. That arithmetic, not laziness, is why professional polls cluster near 1,000 respondents: beyond it, the same money usually buys more accuracy spent on better sampling and better questions than on raw size.
Margin of error and the confidence interval
The margin of error is a half-width looking for a centre, and the centre is your observed proportion. Together they form the confidence interval: observed p ± MOE. A result of 62% with a margin of 3.10% gives the interval 58.90% to 65.10%, and this calculator shows that interval directly under the headline in the first mode, because the interval is what readers actually reason with. When two options are compared, the honest comparison is between intervals, not point figures: 52% against 48% with a ±3.10% margin on each is a race whose intervals overlap heavily. Strictly, comparing two proportions from the same sample needs the margin of the difference, which is not simply twice either margin — another reason this page reports intervals rather than verdicts.
Spreadsheets and code: Excel, Sheets and Python
Every serious tool implements the same four steps, so cross-checking is easy. In Excel and Google Sheets, with a proportion as a decimal in A1 and a sample size in A2, the 95% margin is =1.96*SQRT(A1*(1-A1)/A2); swap 1.96 for 1.645 or 2.576 for the other levels. The required sample size for a target margin in A3 is =ROUNDUP(1.96^2*A1*(1-A1)/A3^2, 0) — the ROUNDUP is the rounding rule the sample-size section insists on. Excel's CONFIDENCE.NORM is a near relation, not the same thing: it returns the margin for a mean given a standard deviation, the right tool for measurement data and the wrong one for a survey proportion.
In Python the same calculation is three lines with the standard library alone: import math, then moe = 1.96 * math.sqrt(p * (1 - p) / n), and n_needed = math.ceil(1.96**2 * p * (1 - p) / moe**2). Small last-decimal differences between tools are rounding, while a difference in the first decimal almost always means a different quantity was computed — most often a proportion entered as 50 where the formula expected 0.5.
Common mistakes
Entering the proportion as a percentage in the formula by hand. The formula wants p as a decimal: 0.5, not 50. Using 50 inflates p(1 − p) into nonsense and produces margins in the hundreds of percent. This calculator takes the percentage at the door and converts it for you; a spreadsheet will not.
Quoting the headline margin for a subgroup. The margin belongs to the n it was computed from. A subgroup of 120 inside a poll of 1,000 carries a margin near ±8.95% at 95%, not the headline ±3.10% — recompute with the subgroup's own sample size before comparing subgroup figures.
Rounding the required sample size down. Sample sizes round up, always. 1,067.07 rounds to 1,068; fielding 1,067 delivers a margin fractionally wider than the target you set, which matters exactly when a client or a methods chapter checks.
Applying the finite population correction to a huge population, or forgetting it for a tiny one. For a national poll the correction is 1.000 to three decimals and safe to skip; for a survey covering a fifth of a small company it is the difference between an honest margin and a needlessly gloomy one.
Reading the margin as total error. The most consequential mistake of all, and the subject of the next section: the margin prices sampling error only, and a badly worded, badly sampled or badly weighted survey can be wrong by far more than its margin while quoting it proudly.
Honest limits: what this calculator does not do
The central limit deserves plain words: this formula assumes a simple random sample and an estimate of a proportion, and it measures sampling error only. A simple random sample — every member of the population equally likely to be chosen, independently — is a textbook ideal that real surveys approximate rather than achieve. Real polls sample in clusters, stratify by region and demographics, and then weight the responses so the sample matches the population on age, sex, education and past behaviour. Each of those steps is good practice, and each changes the true sampling error: clustering and weighting typically inflate it by a design effect that is commonly somewhere between 1.1 and 2, meaning a real poll's effective margin can be noticeably wider than the figure this formula returns for the same n.
Beyond sampling sit the errors no margin formula touches. Non-response error arises because the people who answer surveys differ from those who refuse — and response rates to telephone polls now sit in single digits in many countries, so that difference can be large. Coverage error, question wording, question order and honest misreporting move answers by amounts that routinely exceed ±3.10%. This calculator captures none of that, and it does not handle margins for means or for differences between two proportions, each of which has its own formula. What it does promise: the standard textbook calculations, with the finite population correction, computed exactly as the worked examples show, in your browser, free, with nothing uploaded — a floor for a survey's total uncertainty, not the whole of it.
Sources and References
- Pew Research Center — Understanding the margin of error in election polls — how a professional polling organisation explains the margin of error, and why it understates total survey error.
- NIST/SEMATECH e-Handbook of Statistical Methods — What are confidence intervals? (7.1.4) — the US National Institute of Standards and Technology reference on confidence intervals and their correct interpretation.
- NIST/SEMATECH e-Handbook of Statistical Methods — Normal Distribution (1.3.6.6.1) — the NIST reference on the normal model from which the 1.645, 1.960 and 2.576 z-values are read.
- Boston University School of Public Health — Confidence Intervals — a university statistics teaching module on confidence intervals for proportions, including the role of sample size.
- Wikipedia — Margin of error — the definition of the margin of error, its formula for a proportion, and its relationship to the confidence interval.
- Wikipedia — Sample size determination — how a required sample size is derived from a target margin of error, including the finite population correction.
- Wikipedia — Finite population correction — the correction factor for samples drawn from a finite population, and when it materially changes the standard error.
Sources note: all seven sources above were verified live on 24 November 2026 and returned HTTP 200 to a direct request, including the Pew Research Center and NIST/SEMATECH pages. No source needed substitution, and none is included on the strength of a search-result snippet alone.