Margin of error calculator: formula and worked example

By Jude Wallis · Published

Margin of error = critical value x standard error. For a proportion, ME = z* sqrt(p-hat(1-p-hat)/n). At p-hat = 0.5, n = 1000, 95% confidence, ME = 1.96 x 0.01581 = 0.031, about plus or minus 3.1 points.

margin of error (proportion)

± 0.031

As a percentage: about ± 3.1 points. To halve the margin of error you need roughly four times the sample size.

Steps

  1. 1.z* for 95% confidence = 1.96
  2. 2.SE = sqrt(p-hat(1 - p-hat)/n) = sqrt(0.5 x 0.5 / 1000) = 0.01581
  3. 3.ME = z* x SE = 1.96 x 0.01581 = 0.031

AP Statistics: Unit 3 (topics 3.3). This maps to Unit 3 topic 3.3, Constructing a Confidence Interval for a Population Proportion, where the margin of error is the critical value times the standard error and equals half the width of the interval.

What the margin of error calculator does

This margin of error calculator turns three inputs into the plus-or-minus number you attach to a poll or survey. You enter the sample proportion p^\hat{p} (the fraction of your sample with the trait you care about), the sample size nn, and a confidence level such as 95%. It returns the margin of error and the full confidence interval, so you see both the plus-or-minus amount and the two endpoints.

The margin of error, written ME, is the plus-or-minus amount around your estimate. A poll reported as 52% with a margin of error of 3 points is really claiming the interval runs from 49% to 55%. The calculator does the arithmetic below for you, but the steps are worth knowing so you can check the output and understand why the number comes out the way it does.

The margin of error formula for a proportion

Margin of error is a critical value times the standard error:

ME=z×SEME = z^* \times SE

Here zz^* is the critical value, the number of standard deviations from the center of a standard normal curve whose plus-or-minus bounds enclose the middle C% (equivalently, how many standard errors you extend out from p^\hat{p} to capture the middle C%), and SESE is the standard error, the typical distance between your estimate p^\hat{p} and the true population proportion pp.

For a single proportion the standard error is SE=p^(1p^)nSE = \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}, so the whole formula is:

ME=zp^(1p^)nME = z^* \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}

The margin of error is exactly half the width of the confidence interval. You build the interval by adding and subtracting it from your estimate, p^±ME\hat{p} \pm ME. That is why a wider margin means a wider, less precise interval.

The critical value z* for each confidence level

The critical value depends only on the confidence level, not on your data. A higher confidence level pulls in a larger zz^*, which widens the margin. These three values come straight from the z-table:

Confidence levelCritical value zz^*
90%1.645
95%1.960
99%2.576

Most published polls report at 95%, which is where the familiar z=1.96z^* = 1.96 comes from. If you raise the level to 99% you gain confidence but pay for it with a wider margin on the same data, as the worked examples show.

Why halving the margin of error needs four times the sample

The sample size sits under a square root, so it has a weaker grip on the margin than you might expect. The margin of error shrinks in proportion to 1n\dfrac{1}{\sqrt{n}}.

To cut the margin of error in half you need n\sqrt{n} to double, which means nn has to quadruple. Going from 1,000 to 2,000 respondents only shrinks the margin by about 29%. You need 4,000 respondents to halve it.

The same square-root relationship drives sample size planning. If you rearrange the formula to solve for nn, you can find the smallest sample that reaches a target margin, which is what the sample size calculator does.

Margin of error for a mean

The same structure works for a mean. The margin of error is still a critical value times a standard error, but you use a tt critical value (tt^*) and the standard error of the sample mean xˉ\bar{x}, which is SE=snSE = \dfrac{s}{\sqrt{n}} where ss is the sample standard deviation.

ME=t×snME = t^* \times \dfrac{s}{\sqrt{n}}

The proportion version above is the one behind the familiar poll number, so it is what this calculator focuses on. For a mean, the confidence interval calculator handles the tt^* lookup and the arithmetic.

The familiar plus or minus 3 points

A poll surveys n = 1000 people and finds a sample proportion of p-hat = 0.5. Find the margin of error at 95% confidence.

  1. Compute p^(1p^)=0.5×0.5=0.25\hat{p}(1-\hat{p}) = 0.5 \times 0.5 = 0.25.

  2. Divide by the sample size: 0.251000=0.00025\dfrac{0.25}{1000} = 0.00025.

  3. Take the square root for the standard error: SE=0.00025=0.01581SE = \sqrt{0.00025} = 0.01581.

  4. Use the 95% critical value z=1.96z^* = 1.96.

  5. Multiply: ME=1.96×0.01581=0.031ME = 1.96 \times 0.01581 = 0.031.

The margin of error is about 0.031, or plus or minus 3.1 percentage points. The 95% confidence interval is 0.5±0.031=(0.469,0.531)0.5 \pm 0.031 = (0.469, 0.531).

Cutting the margin of error in half

Using the same p-hat = 0.5, how large must the sample be to halve the margin of error from 0.031 to about 0.0155?

  1. The margin of error scales with 1n\dfrac{1}{\sqrt{n}}, so halving it requires doubling n\sqrt{n}, which means multiplying nn by 4.

  2. Start from n=1000n = 1000 and quadruple it to n=4000n = 4000.

  3. Check the new standard error: SE=0.254000=0.0000625=0.007906SE = \sqrt{\dfrac{0.25}{4000}} = \sqrt{0.0000625} = 0.007906.

  4. Multiply by the same critical value: ME=1.96×0.007906=0.0155ME = 1.96 \times 0.007906 = 0.0155.

A sample of n = 4000 gives a margin of error of about 0.0155, half the original. Four times the data buys half the margin.

Same poll at 99% confidence

Keep p-hat = 0.5 and n = 1000, but report at 99% confidence instead of 95%.

  1. The standard error is unchanged: SE=0.251000=0.01581SE = \sqrt{\dfrac{0.25}{1000}} = 0.01581.

  2. Swap in the 99% critical value z=2.576z^* = 2.576.

  3. Multiply: ME=2.576×0.01581=0.0407ME = 2.576 \times 0.01581 = 0.0407.

The margin of error grows to about 0.0407, or plus or minus 4.1 percentage points. More confidence costs a wider interval for the same data.

Frequently asked questions

Is the margin of error the same as the confidence interval?

No. The margin of error is the plus-or-minus amount, and it equals half the width of the confidence interval. You get the interval by adding and subtracting the margin from your estimate, so p^=0.52\hat{p} = 0.52 with a margin of 0.03 gives the interval 0.49 to 0.55.

Why do so many polls report plus or minus 3 points?

Most national polls use a sample near 1,000 people at 95% confidence. Setting p^=0.5\hat{p} = 0.5 makes the margin as large as it can be, and 1.96×0.25/1000=0.0311.96 \times \sqrt{0.25/1000} = 0.031, so about 3 points is the reported worst case.

Does a larger sample always shrink the margin of error?

Yes, but with diminishing returns. Because the margin scales with 1/n1/\sqrt{n}, each extra respondent helps less than the one before, and you need four times the sample to cut the margin in half.