Margin of Error Calculator
Work out how far a poll or survey result could be from the truth, how many people you need to poll for a target margin, or the margin on an average. Drop in your sample size and result, pick a confidence level, and the page returns the margin drawn to scale, in plain words, with the R code to reproduce it.
±3.1 points
How it is computed
Which margin, and which formula
The three modes answer three different questions. Here is what each one uses and when to reach for it.
| Mode | Answers | Formula | Use it when |
|---|---|---|---|
| Percentage margin | How far off could my % be? | z·√(p(1−p)/n) | You have a poll or yes/no survey result and its sample size. |
| Required sample size | How many people do I need? | z²p(1−p)/m² | You are planning a survey to a chosen margin (Cochran). |
| Average margin | How far off could my mean be? | t·s/√n | Your outcome is a number (spend, time, score), not a percentage. |
The percentage margin uses the normal approximation, the same symmetric band pollsters quote as “plus or minus.” The average margin uses the Student t critical value with n−1 degrees of freedom because the standard deviation is itself estimated from the sample; switch to z only when the population SD is genuinely known. A finite-population correction, √((N−n)/(N−1)), kicks in when you supply a population size and your sample is a sizeable slice of it.
Questions people ask
What is the margin of error in a survey?
It is how far your result could reasonably sit from the true figure in the whole population, purely from the luck of who landed in your sample. A result of 52% with a 3-point margin means the real value is very likely between 49% and 55%. It gets smaller as the sample grows, following z·√(p(1−p)/n).
What sample size do I need for a 3% margin of error?
At 95% confidence and the cautious 50% assumption, a 3-percentage-point margin needs about 1,068 respondents. Use the Required sample size mode, enter a 3% target, and the page rounds the Cochran formula up to a whole number of people. A tighter 2% margin needs about 2,401.
Why do these calculations often use 50 percent?
The term p(1−p) is largest at 50%, so 50% gives the widest, most cautious margin. Pollsters quote that worst case so the stated margin holds however the answers split. If you already have a result far from 50%, enter it and the margin drops a little.
Does a bigger population need a bigger sample?
Barely. Past a few thousand people the margin depends on the sample size, not the population, which is why a 1,000-person sample serves a city or a whole country equally well. It only matters when your sample is a large fraction of a small group; enter a population size and the finite-population correction shrinks the margin.
Does this calculator match R?
Yes. The percentage margin uses the same qnorm construction as R, the average margin reproduces the half-width of t.test() to the decimal, and the sample-size mode matches the Cochran formula. Every mode was checked against R 4.6.0.
Keep going
Tools that pick up where the margin leaves off.