Margin of Error Formula Explained (With Worked Examples)
By Shihab Mia June 27, 2026 6 min read
Quick answer
For a proportion, margin of error = z x square root of (p(1 - p) / n). Here p is the sample proportion (use 0.5 for the largest, safest margin), n is the sample size, and z is the critical value (1.96 for 95 percent confidence). For a mean, swap in the standard deviation: margin of error = z x (standard deviation / square root of n). The margin shrinks as the square root of n grows, so to halve it you need roughly four times the sample.
When a poll says a candidate is at 52 percent "plus or minus 3 points," that 3 points is the margin of error (MOE). It is the cushion of uncertainty around a sample result, a way of admitting that you measured a slice of the population, not all of it. Get the formula right and you can read any survey honestly. Get it wrong and you will either overclaim precision you do not have or panic over differences that are pure noise.
This guide breaks the margin of error formula into plain pieces, walks through two worked examples, and shows exactly why bigger samples help less than people expect.
What the margin of error formula actually is
There are two versions you will meet most often, depending on what you are measuring. If you are measuring a percentage or proportion (the share of people who say yes, click, or prefer option A), use this:
Margin of error for a proportion
MOE = z x square root of ( p(1 - p) / n )
If you are measuring an average (mean height, mean spend, mean response time), use the version built on the standard deviation:
Margin of error for a mean
MOE = z x ( standard deviation / square root of n )
Both formulas share the same skeleton: a critical value z that sets your confidence level, multiplied by a measure of spread, divided by the square root of the sample size. The MOE is one half of the full confidence interval, so the interval runs from your estimate minus the MOE to your estimate plus the MOE. If you want the full picture of that range, see our companion guide on the confidence interval formula.
Breaking down each ingredient
z, the critical value
The z value comes from the normal distribution and encodes how confident you want to be. A higher confidence level means a wider margin, because you are casting a bigger net to be more certain the truth falls inside it. These are the values you will use almost every time:
Common confidence levels and their z critical values
| Confidence level | z value |
|---|---|
| 80 percent | 1.28 |
| 90 percent | 1.645 |
| 95 percent | 1.96 |
| 98 percent | 2.33 |
| 99 percent | 2.576 |
When in doubt, use 1.96 for 95 percent confidence. It is the industry default for polling and most reporting.
p, the sample proportion
For the proportion formula, p is the share you measured, written as a decimal. If 240 of 400 people said yes, p is 0.6. The term p(1 - p) is the variability of a yes or no answer, and it is largest exactly when p equals 0.5. That is why pollsters often plug in p = 0.5: it gives the most conservative, widest margin, so the real margin can only be smaller. If you do not yet know p, 0.5 is the safe planning assumption.
n, the sample size
n is how many people or items you sampled. It sits under a square root, which is the single most important fact about margin of error: the margin shrinks in proportion to 1 / square root of n. Doubling your sample does not halve the margin. To cut the margin in half you need about four times the sample, and to cut it to a third you need about nine times. This is the law of diminishing returns that makes very tight polls expensive.
Worked example: a proportion
Suppose you survey 1,000 voters and 520 of them (52 percent) back a measure. You want a 95 percent margin of error.
- Write down the inputs: p = 0.52, n = 1000, and z = 1.96 for 95 percent confidence.
- Compute p(1 - p): 0.52 x 0.48 = 0.2496.
- Divide by n: 0.2496 / 1000 = 0.0002496.
- Take the square root: square root of 0.0002496 is about 0.0158.
- Multiply by z: 1.96 x 0.0158 = about 0.031, which is 3.1 percent.
- Report it: 52 percent plus or minus 3.1 points, so the true support is likely between about 48.9 and 55.1 percent.
Notice the interval crosses 50 percent, so even though your sample leans yes, you cannot confidently claim a majority. That is the kind of judgment the margin of error is designed to protect.
Worked example: a mean
Now suppose you measure the average checkout time on a website. From 144 sessions you find a standard deviation of 30 seconds, and you want 95 percent confidence.
- Inputs: standard deviation = 30, n = 144, z = 1.96.
- Square root of n: square root of 144 = 12.
- Standard error: 30 / 12 = 2.5 seconds.
- Multiply by z: 1.96 x 2.5 = 4.9 seconds.
- So your mean checkout time is accurate to about plus or minus 4.9 seconds at 95 percent confidence.
That middle quantity, standard deviation divided by the square root of n, is the standard error, the engine inside both formulas. It is worth knowing on its own, so we cover it in depth in our standard error guide.
Why bigger samples help less and less
Because n lives under a square root, the payoff from extra responses fades fast. The table below holds p at 0.5 and confidence at 95 percent so you can see the margin flatten out.
Margin of error at 95 percent confidence, p = 0.5
| Sample size n | Approx. margin of error |
|---|---|
| 100 | 9.8 percent |
| 400 | 4.9 percent |
| 1,000 | 3.1 percent |
| 1,600 | 2.5 percent |
| 4,000 | 1.5 percent |
Going from 100 to 400 (four times the work) halves the margin from 9.8 to 4.9 percent. Going from 1,000 to 4,000 (also four times the work) only buys you a drop from 3.1 to 1.5 percent. That trade-off is exactly why most national polls settle around 1,000 to 1,500 respondents: it is the sweet spot before precision gets expensive.
Common mistakes to avoid
- Treating the margin as the whole story. MOE only captures sampling error, the randomness of who you happened to ask. It says nothing about biased questions, bad sampling frames, or people who lied.
- Forgetting it is plus and minus. A 3 point margin means the interval spans 6 points total. Two results that differ by less than the combined margins may not differ at all.
- Using the wrong z. A 90 percent and a 99 percent margin are not the same. Always state your confidence level alongside the number.
- Writing p as a percent in the formula. Use 0.52, not 52, or your math will blow up. Convert percentages to decimals first, the same way you would in any percentage calculation.
- Assuming a huge population needs a huge sample. For large populations, the margin depends on n, not on the population size. A good 1,200 person sample works for a city or a whole country.
Good to know: the finite population tweak
When your sample is a large fraction of a small population (say you survey 200 of 500 club members), the standard formula slightly overstates the margin. Statisticians multiply by a finite population correction factor to shrink it. For the surveys most people run, where the population dwarfs the sample, this correction is tiny and safely ignored. Reach for it only when your sample exceeds about 5 percent of the whole group.
๐ Try the free tool Margin of Error Calculator Free margin of error calculator for surveys and polls. Enter your sample size, confidence level, and proportion to get the MOE percent and confidence interval.The margin of error formula is short, but it carries a big idea: every sample-based number is really a range, and the honest thing to do is report that range. Know your z, plug in p and n, and you can read any poll or experiment without being fooled by noise or false precision. Use 1.96 and p = 0.5 when you want the safe, conservative answer, and reach for the calculator above to skip the arithmetic.