Confidence Intervals Sampling Survey Statistics 22 min read June 15, 2026
BY: Statistics Fundamentals Team
Reviewed By: Minsa A (Senior Statistics Editor)

Margin of Error: Formula, Calculator & How to Calculate It

A poll reports that 54% of voters prefer Candidate A — with a margin of error of ±3%. That three-percentage-point figure is doing serious work. It tells you the actual share could be anywhere from 51% to 57%, which is the difference between a close race and a comfortable lead. The margin of error is how statistics communicates the unavoidable uncertainty of learning about a large population from a small sample.

This guide covers the definition, both formulas (for means and proportions), a step-by-step calculation procedure, an interactive calculator, three worked case studies, and a comparison between margin of error and related concepts. Every formula uses standard notation consistent with the NIST Engineering Statistics Handbook.

What You'll Learn
  • ✓ The exact definition of margin of error and what it does and does not measure
  • ✓ The formula for means (with σ known) and for proportions
  • ✓ A step-by-step calculation procedure with a free interactive calculator
  • ✓ Three worked examples from polling, clinical trials, and quality control
  • ✓ How sample size, confidence level, and variability govern the MOE
  • ✓ Margin of error vs. standard error — precisely defined
  • ✓ Python and R code to compute MOE programmatically

What Is the Margin of Error?

Definition — Margin of Error (MOE)
The margin of error (MOE) is a statistical metric that quantifies the maximum expected difference between a sample statistic and the true population parameter at a specific confidence level. It expresses the radius of a confidence interval — the range within which the actual population value is likely to fall due to random sampling variability.
MOE = z* × SE

When a news organization reports a poll result with "±3 percentage points," that figure is the margin of error. It does not mean the poll is wrong by 3 points. It means that if you repeated the same poll many times under identical conditions, 95% of the resulting confidence intervals would contain the true population value. The margin of error is the half-width of that interval.

One constraint worth stating early: the margin of error only accounts for random sampling error. It says nothing about non-sampling errors — question wording bias, non-response bias, undercoverage, or measurement error. A poorly designed survey with n = 10,000 can have a tiny MOE and still produce a deeply misleading estimate. This limitation is frequently overlooked when poll numbers are reported in the press.

⚠️
What the Margin of Error Does Not Cover

MOE measures only random sampling variability. Systematic bias from non-probability sampling, poorly worded questions, or low response rates will not appear in the MOE figure, no matter how large the sample is.

Sampling and Polls: A Brief History

The modern polling margin of error traces directly to the work of Jerzy Neyman, whose 1934 paper on stratified sampling established the mathematical framework for confidence intervals that underpins survey reporting today. George Gallup's successful prediction of the 1936 U.S. presidential election — using a sample of roughly 50,000 against the Literary Digest's flawed poll of 2.4 million — made it clear that sample design mattered far more than raw sample size. The margin of error became the standard summary of that design's precision.

Today the same principles apply to study design in clinical trials, quality control in manufacturing, and A/B testing in software products. The underlying math is described in detail in the sampling distributions section on Statistics Fundamentals.

The Three Variables That Control MOE

↑ n
Larger sample → smaller MOE
↑ CL
Higher confidence → larger MOE
↑ σ
More variability → larger MOE

These three relationships are not independent. Increasing the confidence level from 95% to 99% requires a larger critical value (from z* = 1.960 to z* = 2.576), which directly increases the MOE. Recovering that precision requires a larger sample. This trade-off is exactly what sample size calculators are built to solve.

How to Calculate Margin of Error: Step-by-Step Formulas

There are two standard versions of the margin of error formula, one for estimating a population mean and one for estimating a population proportion. The choice depends on what you measured in your sample.

Formula for a Population Mean (μ)

Margin of Error — Population Mean
MOE = z* × (σ / √n)
z* = critical value for confidence level σ = population standard deviation n = sample size σ/√n = standard error (SE)

When the population standard deviation σ is unknown — which is the usual case — substitute the sample standard deviation s and use the t-distribution critical value t* instead of z*. The degrees of freedom are df = n − 1. This matters most when n is small (under 30). For large samples, the t and z critical values converge and the distinction becomes negligible. See the full confidence interval for a mean guide for the t-distribution version.

1

Set the confidence level and locate z*

For 90% confidence: z* = 1.645. For 95%: z* = 1.960. For 99%: z* = 2.576. These come from the standard normal distribution — see the z-table for full values.

2

Identify σ (or s) and n

Use the known population SD if available. Otherwise use the sample SD. Record the sample size n — the number of individual observations collected.

3

Calculate the standard error

SE = σ / √n. Divide the standard deviation by the square root of the sample size. This is the standard deviation of the sample mean's sampling distribution — explained further in the sample mean distribution guide.

4

Multiply: MOE = z* × SE

This is the margin of error as a raw number (same units as your measurement). To express it as a percentage, divide by the sample mean and multiply by 100.

Formula for a Population Proportion (p)

Margin of Error — Population Proportion
MOE = z* × √[p̂(1 − p̂) / n]
z* = critical value for confidence level = sample proportion n = sample size √[p̂(1−p̂)/n] = standard error of proportion

When p̂ is unknown in advance — for example, before a poll is conducted — use p̂ = 0.5. This produces the most conservative (largest) possible margin of error, because the expression p̂(1 − p̂) reaches its maximum at p̂ = 0.5. Sample size tables in research proposals almost always assume p̂ = 0.5 for this reason.

ℹ️
Finite Population Correction (FPC)

When the sample is a substantial fraction of a small population, multiply the standard error by √[(N − n) / (N − 1)], where N is the total population size. For large populations (N > 10,000), this correction is negligible and safely ignored.

Formula derivation: Cochran, W.G. (1977). Sampling Techniques, 3rd ed. John Wiley & Sons. Critical values from the NIST Standard Normal Probability Table.

Live Margin of Error Calculator

Enter your study parameters below. The calculator handles both the proportion formula (most common for surveys) and the mean formula. Select the calculation type first to see the relevant inputs.

🧮 Margin of Error Calculator

Lower Confidence Bound
Upper Confidence Bound

Confidence Interval Structure: Point Estimate ± Margin of Error

Lower Bound
(Estimate − MOE)
Point
Estimate
Upper Bound
(Estimate + MOE)

The margin of error is the radius of the confidence interval — the maximum distance expected between the sample statistic and the true population value at the chosen confidence level.

Worked Examples: Three Real-World Scenarios

Case Study 1 — Political Polling at 95% Confidence

Worked Example — Proportion Formula (95% CL)

Problem: A polling firm surveys 1,200 likely voters. 54% say they plan to vote for Candidate A. What is the margin of error at 95% confidence, and what is the confidence interval?

Proportion MOE Formula
MOE = z* × √[p̂(1 − p̂) / n]
z* = 1.960 (95% CL) = 0.54 n = 1,200
1

Critical value: 95% confidence → z* = 1.960. This comes from the standard normal distribution: 95% of area falls within ±1.960 standard deviations of the mean.

2

Standard error: SE = √[0.54 × 0.46 / 1200] = √[0.2484 / 1200] = √0.000207 = 0.01439

3

MOE: 1.960 × 0.01439 = 0.0282 = 2.82% (rounds to ±3%)

4

Confidence interval: 0.54 ± 0.0282 → [51.2%, 56.8%]

✅ Interpretation: We are 95% confident the true population proportion supporting Candidate A is between 51.2% and 56.8%. The candidate's lead appears real — the lower bound (51.2%) still exceeds 50%. If the MOE had straddled 50%, the race would be a statistical toss-up.

Case Study 2 — Clinical Trial Efficacy at 99% Confidence

Worked Example — Mean Formula (99% CL)

Problem: A clinical trial measures blood pressure reduction in 80 patients. The sample mean reduction is 12.4 mmHg with a known population SD of σ = 6.5 mmHg. Compute the 99% confidence interval and margin of error.

Mean MOE Formula
MOE = z* × (σ / √n)
z* = 2.576 (99% CL) σ = 6.5 mmHg n = 80
1

Critical value: 99% confidence → z* = 2.576. Clinical standards typically use 99% confidence (α = 0.01) to reduce the risk of false positives.

2

Standard error: SE = 6.5 / √80 = 6.5 / 8.944 = 0.7270 mmHg

3

MOE: 2.576 × 0.7270 = 1.87 mmHg

4

99% CI: 12.4 ± 1.87 → [10.53 mmHg, 14.27 mmHg]

✅ Interpretation: We are 99% confident the true mean blood pressure reduction is between 10.53 and 14.27 mmHg. Since the entire interval lies well above zero, there is strong statistical evidence of a real treatment effect. The higher confidence level required a wider interval — a direct cost of reducing α from 0.05 to 0.01.

Case Study 3 — Manufacturing Quality Control at 90% Confidence

Worked Example — Proportion Formula (90% CL)

Problem: A manufacturer inspects a sample of 300 components and finds 18 defective (p̂ = 6%). They want a 90% confidence interval for the true defect rate to inform production adjustments.

1

Critical value: 90% confidence → z* = 1.645

2

Standard error: SE = √[0.06 × 0.94 / 300] = √[0.0564 / 300] = √0.000188 = 0.01371

3

MOE: 1.645 × 0.01371 = 0.02255 = 2.26%

4

90% CI: 6% ± 2.26% → [3.74%, 8.26%]

✅ Interpretation: At 90% confidence the true defect rate is between 3.74% and 8.26%. If the manufacturer's tolerance threshold is 5%, the upper bound of 8.26% warrants investigation — the sample alone cannot rule out a defect rate double the target. Using 90% rather than 95% was a deliberate choice to allow a slightly narrower interval with a lower sample cost.

Quick-Reference Calculation Matrices

Critical Value Cheat Sheet

Confidence Level Alpha (α) Tail Area (α/2) Critical Value z*
90% 0.10 0.050 1.645
95% 0.05 0.025 1.960
99% 0.01 0.005 2.576
Source: Z-table — Statistics Fundamentals. Values are two-tailed critical values for the standard normal distribution.

Sample Size Impact on MOE (95% CL, p̂ = 0.5)

Sample Size (n) Standard Error (SE) Margin of Error (MOE) Change from n = 100
1000.05009.8%
5000.02244.4%−55%
1,0000.01583.1%−68%
2,0000.01122.2%−78%
5,0000.00711.4%−86%
10,0000.00501.0%−90%

This table demonstrates the diminishing returns of increasing sample size. Going from n = 100 to n = 1,000 (ten times larger) reduces MOE from 9.8% to 3.1% — not by a factor of ten, but by roughly two-thirds. That square-root relationship means you need 100× the sample to get 10× the precision. The sample size calculator makes it straightforward to solve for n given a target MOE.

Statistical Comparisons: MOE vs. Related Concepts

Margin of Error vs. Standard Error

These two terms are frequently confused because both measure variability in sample statistics. The distinction is precise and worth getting right.

Concept Standard Error (SE) Margin of Error (MOE)
DefinitionSD of the sampling distribution of a statisticMaximum expected deviation between sample and population at a set confidence level
FormulaSE = σ/√n (for mean)
SE = √[p̂(1−p̂)/n] (for proportion)
MOE = z* × SE
Confidence levelNot tied to a confidence levelAlways tied to a specific confidence level (e.g., 95%)
Reported?Mostly in academic tables and regression outputStandard in poll and survey reporting
RelationshipBuilding block of MOESE scaled by a critical value

The standard error is a property of the statistic and the sample design. The margin of error adds the decision about how confident you want to be, converting SE into the language of interval estimation. For more on SE and its role in inference, see the guide to sampling distributions of sample proportions.

Margin of Error vs. Confidence Interval

Concept Margin of Error Confidence Interval
What it isThe half-width of the CI (a single number)A range: [estimate − MOE, estimate + MOE]
Tells youHow precise the estimate isThe range likely to contain the true value
Example± 3%[51%, 57%]
Used inPolls, news reports, sample size planningAcademic papers, data analysis, decision-making

The confidence interval tells you where the truth probably lives. The margin of error tells you how wide that region is. You need both to interpret a survey result fully. See the confidence interval for a proportion and confidence interval for a mean pages for the full derivation of each.

Where Margin of Error Appears in Practice

🗳️

Political Polling

The most visible use. News organizations report MOE alongside every poll result. A 3-point lead within a ±3% MOE is a statistical dead heat.

🧪

Clinical Research

Trial results report CIs around treatment effects. Regulators at the FDA and EMA use interval width as a measure of evidence quality.

🏭

Quality Control

Acceptance sampling plans specify MOE thresholds. A batch is approved only when the defect rate CI falls below the tolerance limit.

📊

Market Research

Brand tracking surveys, customer satisfaction scores, and net promoter scores all carry a MOE that governs meaningful change detection.

Python and R Implementation

Python (scipy.stats)

Python
import scipy.stats as stats
import math

# Margin of error for a proportion
def moe_proportion(p_hat, n, confidence=0.95):
    z = stats.norm.ppf(1 - (1 - confidence) / 2)
    se = math.sqrt((p_hat * (1 - p_hat)) / n)
    moe = z * se
    return {
        "moe": round(moe, 4),
        "lower": round(p_hat - moe, 4),
        "upper": round(p_hat + moe, 4),
        "z_star": round(z, 3)
    }

# Margin of error for a mean (known σ)
def moe_mean(sigma, n, x_bar=None, confidence=0.95):
    z = stats.norm.ppf(1 - (1 - confidence) / 2)
    se = sigma / math.sqrt(n)
    moe = z * se
    result = {"moe": round(moe, 4), "z_star": round(z, 3)}
    if x_bar is not None:
        result["lower"] = round(x_bar - moe, 4)
        result["upper"] = round(x_bar + moe, 4)
    return result

# Examples
print(moe_proportion(0.54, 1200, confidence=0.95))
# {'moe': 0.0282, 'lower': 0.5118, 'upper': 0.5682, 'z_star': 1.96}

print(moe_mean(6.5, 80, x_bar=12.4, confidence=0.99))
# {'moe': 1.8727, 'z_star': 2.576, 'lower': 10.5273, 'upper': 14.2727}

R Script

R
# Margin of error for a proportion
moe_proportion <- function(p_hat, n, confidence = 0.95) {
  z <- qnorm(1 - (1 - confidence) / 2)
  se <- sqrt((p_hat * (1 - p_hat)) / n)
  moe <- z * se
  list(moe = round(moe, 4),
       lower = round(p_hat - moe, 4),
       upper = round(p_hat + moe, 4),
       z_star = round(z, 3))
}

# Margin of error for a mean (known sigma)
moe_mean <- function(sigma, n, x_bar = NULL, confidence = 0.95) {
  z <- qnorm(1 - (1 - confidence) / 2)
  se <- sigma / sqrt(n)
  moe <- z * se
  result <- list(moe = round(moe, 4), z_star = round(z, 3))
  if (!is.null(x_bar)) {
    result$lower <- round(x_bar - moe, 4)
    result$upper <- round(x_bar + moe, 4)
  }
  result
}

# Examples
moe_proportion(0.54, 1200, confidence = 0.95)
moe_mean(6.5, 80, x_bar = 12.4, confidence = 0.99)

Entity and Formula Glossary

Term Formula Interpretation
Margin of Error MOE = z* × SE Maximum expected distance between the sample statistic and the true population parameter at a stated confidence level
Confidence Interval Estimate ± MOE The range [Lower, Upper] constructed to contain the true parameter with probability equal to the confidence level
Confidence Level 1 − α The long-run proportion of identically constructed intervals that will contain the true parameter
Standard Error (mean) SE = σ / √n Standard deviation of the sample mean's sampling distribution; measures how much x̄ varies across repeated samples
Standard Error (proportion) SE = √[p̂(1−p̂)/n] Standard deviation of the sample proportion's sampling distribution
Critical Value z* or t* The z or t score that cuts off the tail(s) at α/2 for a two-tailed interval; depends on the confidence level
Sample Size n Number of independent observations; MOE decreases proportionally to 1/√n
Point Estimate p̂ or x̄ The single sample-based value used to estimate the population parameter; the center of the confidence interval

Frequently Asked Questions

What is a good margin of error?
A margin of error between 1% and 5% is considered good in public opinion polling and market research — it offers a solid balance between precision and the cost of data collection. Values up to 10% are workable for exploratory or pilot research. Clinical trials typically require margins well under 1%, because the consequences of imprecision are medical rather than commercial. The right MOE depends entirely on what decision the data will inform.
Why do polls always report a margin of error?
Polls sample a small fraction of a large population and use those responses to infer the opinions of everyone. Because different random samples would produce slightly different results, any single poll estimate carries uncertainty. The margin of error quantifies that uncertainty, telling readers how far the reported figure might reasonably differ from the true population value. Without it, a poll result has no interpretable precision — you cannot tell whether a 2-point lead is meaningful or noise.
How do you reduce the margin of error?
There are three direct ways to reduce MOE. First, increase the sample size — the most reliable method, though expensive. Because MOE scales with 1/√n, you must quadruple n to halve MOE. Second, lower the confidence level from 99% to 95% or 90%, which reduces the critical value z* and narrows the interval at the cost of less certainty. Third, reduce population variability through stratified sampling, which can lower the effective standard deviation for each stratum. The sample size calculator lets you experiment with all three levers simultaneously.
What is the difference between margin of error and standard error?
The standard error (SE) is the standard deviation of a sample statistic's sampling distribution — it measures how much the statistic varies from sample to sample. It is a property of the data and sample design alone. The margin of error equals the critical value z* multiplied by the SE, adding the confidence level into the picture. The SE is a building block; the MOE is what gets reported. In a normal distribution, 95% of sample means fall within ±1.96 SE of the population mean — which is exactly what the 95% margin of error represents.
Does the margin of error account for all sources of survey error?
No. The margin of error accounts only for random sampling error — the natural variability that comes from selecting a sample rather than measuring the entire population. It does not measure non-sampling errors: question wording bias, social desirability effects, non-response bias, coverage error (missing groups in the sampling frame), or data entry mistakes. A survey with a tight 2% MOE can still produce a wildly inaccurate estimate if its design is systematically biased.
When should I use the t-distribution instead of the z-distribution?
Use the t-distribution when the population standard deviation σ is unknown and you are estimating it from the sample (using s). The t-distribution has heavier tails than the normal, accounting for the extra uncertainty in estimating σ. For large samples (n > 120), the difference between t* and z* is negligible. For small samples, it matters considerably: at df = 10, the 95% critical value is t* = 2.228, not 1.960. The full breakdown is in the t-distribution guide.