Statistics
Margin of error calculator
The margin of error is the ± that goes after an estimate. Choose a mean or a proportion, enter the standard deviation or proportion and the sample size, and pick a confidence level. The calculator returns the margin with the working shown.
Show the working, step by step
Divide the standard deviation by the square root of the sample size to get the standard error of the mean.
SE = s ÷ √n = 12 ÷ √40 = 1.89737
Look up the critical value for 95% confidence. With a sample SD the right one comes from the t distribution on n − 1 = 39 degrees of freedom.
t* = 2.0227 (z* = 1.96)
Multiply.
E = t* × SE = 2.0227 × 1.89737 = ±3.83779
With z instead of t the margin is ±3.71877. The two converge as n grows; below about 30 the z version understates the uncertainty. To halve the margin you need four times the sample.
What the margin of error is
Any estimate from a sample would come out a little differently if you drew another sample. The margin of error puts a number on that. Add and subtract it from the estimate and you have a confidence interval: a range built by a method that, at 95% confidence, contains the true value in 95% of samples.
It covers random sampling error only. It says nothing about a biased sample, leading questions, non-response or measurement error, which are often larger.
The formulas
For a mean, using the sample standard deviation s:
E = t* × s / √n (t* on n − 1 degrees of freedom)
For a proportion p:
E = z* × √( p(1 − p) / n )
The part after the critical value is the standard error. The critical value sets the confidence level: z* is 1.645, 1.960 and 2.576 for 90%, 95% and 99%. The t* values are larger for small samples.
A worked example: a mean
A sample of 40 delivery times has a standard deviation of 12 minutes. The margin at 95% confidence:
- SE = 12 ÷ √40 = 1.89737 minutes.
- t* for 39 degrees of freedom = 2.0227.
- E = 2.0227 × 1.89737 = ±3.838 minutes.
Using z* = 1.96 instead gives ±3.719, which is a little too narrow. Getting the margin down to about ±1.9 minutes would take 160 deliveries, four times as many.
A worked example: a proportion
In a survey of 40 people, 52% say yes. SE = √(0.52 × 0.48 ÷ 40) = 0.078994, so E = 1.96 × 0.078994 = ±0.1548, or ±15.5 percentage points. That is too wide to separate 52% from an even split. The same 52% from 1,000 people carries a margin of about ±3.1 points.
How sample size drives the margin
With s = 12 at 95% confidence:
| n | t* | Margin (t) | Margin (z) | t wider by |
|---|---|---|---|---|
| 5 | 2.776 | ±14.90 | ±10.52 | 41.7% |
| 10 | 2.262 | ±8.58 | ±7.44 | 15.4% |
| 20 | 2.093 | ±5.62 | ±5.26 | 6.8% |
| 40 | 2.023 | ±3.84 | ±3.72 | 3.2% |
| 100 | 1.984 | ±2.38 | ±2.35 | 1.2% |
For a 50% proportion, the 95% margin is ±9.80 points at n = 100, ±4.90 at 400, ±3.10 at 1,000 and ±1.96 at 2,500. Each halving costs four times the sample.
Common mistakes
- Using the SD instead of the standard error. The margin shrinks with √n. The spread of individual values does not.
- Using z for a small sample with an estimated SD. Below about 30 this understates the uncertainty noticeably.
- Reading the overall margin as the margin for a subgroup. A poll's ±3 points applies to the whole sample. The subgroup of 150 people inside it has a margin closer to ±8.
- Comparing two estimates by their margins. Two overlapping intervals can still differ significantly. Test the difference directly, for example with the t-test calculator.
Related calculators
-
Confidence interval
The full interval for a mean: estimate ± margin.
-
Sample size
Work backwards from the margin you need to the n that delivers it.
-
Mean and standard error
Get s, n and SE from your raw data first.
-
Critical value
z* and t* for any confidence level.
Common questions
What is the margin of error?
The margin of error is the half-width of a confidence interval: the ± figure after an estimate. A poll reporting 52% ± 3 points at 95% confidence means the interval 49% to 55% was built by a method that captures the true value 95% of the time.
How do I calculate the margin of error from a standard deviation?
Divide the standard deviation by √n to get the standard error, then multiply by the
critical value for your confidence level: E = t* × s / √n. With s = 12 and
n = 40 at 95%, SE = 1.89737, t* = 2.0227 and E = ±3.838.
Should I use z or t for the margin of error?
Use t whenever the standard deviation was estimated from the same sample, which is almost always. Use z when the population SD is genuinely known, and for proportions, where the survey convention is z. The difference shrinks as n grows: at n = 40 the t margin is 3.2% wider, at n = 10 it is 15% wider.
How do I reduce the margin of error?
Increase the sample, or accept a lower confidence level. Because the margin shrinks with √n, halving it takes four times the sample. The sample size calculator works backwards from the margin you want.
Why is a poll of 1,000 people usually quoted at ±3%?
For a proportion near 50%, the 95% margin is 1.96 × √(0.25 / 1000) = 0.031, or 3.1 percentage points. The size of the population hardly matters once it is much larger than the sample.