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.z* for 95% confidence = 1.96
- 2.SE = sqrt(p-hat(1 - p-hat)/n) = sqrt(0.5 x 0.5 / 1000) = 0.01581
- 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 (the fraction of your sample with the trait you care about), the sample size , 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:
Here 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 to capture the middle C%), and is the standard error, the typical distance between your estimate and the true population proportion .
For a single proportion the standard error is , so the whole formula is:
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, . 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 , which widens the margin. These three values come straight from the z-table:
| Confidence level | Critical value |
|---|---|
| 90% | 1.645 |
| 95% | 1.960 |
| 99% | 2.576 |
Most published polls report at 95%, which is where the familiar 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 .
To cut the margin of error in half you need to double, which means 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 , 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 critical value () and the standard error of the sample mean , which is where is the sample standard deviation.
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 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.
Compute .
Divide by the sample size: .
Take the square root for the standard error: .
Use the 95% critical value .
Multiply: .
The margin of error is about 0.031, or plus or minus 3.1 percentage points. The 95% confidence interval is .
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?
The margin of error scales with , so halving it requires doubling , which means multiplying by 4.
Start from and quadruple it to .
Check the new standard error: .
Multiply by the same critical value: .
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%.
The standard error is unchanged: .
Swap in the 99% critical value .
Multiply: .
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 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 makes the margin as large as it can be, and , 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 , each extra respondent helps less than the one before, and you need four times the sample to cut the margin in half.