TapCub is live — analytics, insights and live chat, free on one platform
Glossary

Margin of error: formula, examples and how to calculate it

Margin of error is the plus-or-minus around a sample estimate. The formula for rates and averages, a conversion-rate example, the margin on a difference between two rates and how many visitors you need.

Emma Collins Reviewed by Su He Also called MoE Last updated Nov 5, 2026 Glossary

Quick answer

The margin of error is the range above and below a sample estimate within which the true value is expected to fall at a given confidence level. For a proportion it is z × √(p(1 − p)/n); it shrinks as the sample size grows.

Formula: MoE = z × √(p(1 − p) ÷ n)

What is margin of error?

The margin of error is the "plus or minus" around a number estimated from a sample. It tells you how far the estimate could plausibly be from the true value because of random sampling alone. "Conversion rate 4.0% ± 0.8 points at 95% confidence" means that if you repeated the measurement many times, intervals built this way would contain the true rate about 95% of the time.

The margin of error is half the width of a confidence interval: estimate − margin to estimate + margin.

Margin of error formula

For a proportion such as a conversion rate, click-through rate or share of users:

MoE = z × √( p × (1 − p) ÷ n )

For a mean such as average order value:

MoE = z × s ÷ √n
  • p is the observed proportion, s the sample standard deviation, n the sample size
  • z depends on the confidence level: 1.645 for 90%, 1.96 for 95%, 2.576 for 99%

How to calculate it: a conversion-rate example

A landing page converted 100 of 2,500 visitors, p = 0.04 (sample data).

  1. Standard error: √(0.04 × 0.96 ÷ 2,500) = 0.00392
  2. Multiply by z for 95%: 1.96 × 0.00392 = 0.0077
  3. Margin of error = ±0.77 percentage points. The 95% interval is 3.23% to 4.77%.

The same 4% rate with different sample sizes:

Visitors (n)Margin of error (95%)Relative to the 4% rate
1,000±1.21 points±30%
2,500±0.77 points±19%
10,000±0.38 points±10%
40,000±0.19 points±5%

Quadrupling the sample halves the margin of error. Going from ±1.2 to ±0.2 points takes 40 times the traffic.

For a mean: 400 orders with an average of $62 and a standard deviation of $48 give a margin of 1.96 × 48 ÷ √400 = ±$4.70.

Margin of error for a difference

Most analytics questions compare two numbers: this week vs last week, variant A vs B, mobile vs desktop. The margin on a difference is larger than either margin alone:

MoE(p₁ − p₂) = z × √( p₁(1 − p₁)/n₁ + p₂(1 − p₂)/n₂ )

Two pages with 5,000 visitors each convert at 4.0% and 4.6%. The difference is 0.6 points, but its margin is ±0.80 points. The interval runs from −0.2 to +1.4 points and includes zero, so the data cannot tell the pages apart yet. This is the same logic as a significance test; see statistical significance and p-value.

What changes the margin of error

  • Sample size. The margin shrinks with √n.
  • Confidence level. 99% confidence widens the margin by about 31% compared with 95% (2.576 vs 1.96).
  • The proportion itself. p × (1 − p) is largest at 50%, so a 50% rate has the widest margin for a given n. Rates near 0% or 100% have narrower absolute margins but wider relative ones.
  • Population size, sometimes. When the sample is a large share of a small population, multiply by the finite population correction √((N − n) ÷ (N − 1)). Surveying 500 of 3,000 customers at p = 0.5 gives ±4.0 points instead of ±4.4.

How many visitors do you need?

Rearranged for n, with a target margin E:

n = z² × p × (1 − p) ÷ E²

To measure a 4% conversion rate to within ±0.5 points at 95% confidence you need 1.96² × 0.04 × 0.96 ÷ 0.005² ≈ 5,901 visitors; within ±1 point, about 1,476. To plan a test that detects a specific lift, use minimum detectable effect and statistical power instead.

What the margin of error does not cover

The margin of error only measures random sampling error. It says nothing about:

  • Biased samples: a survey answered only by happy customers, or analytics that miss visitors who block scripts. See sampling bias.
  • Measurement error: bots counted as people, duplicate events, wrong time zone.
  • Non-independent data: many events from the same user counted as separate observations. Count users, not events, when users are the unit.

Does analytics data even have a margin of error?

A dashboard that counts every tracked visit is not a survey, so in one sense there is no sampling. In practice the margin still matters whenever you treat this week's numbers as evidence about how the site behaves in general: comparing periods, segments or variants, or judging whether a small segment's rate is real. A segment with 300 visitors and a 4% rate carries a margin of about ±2.2 points, wide enough that the "best converting" segment is often just noise.

If your analytics tool samples data before reporting, the sample adds its own margin on top; see data sampling. TapCub reports on all collected events rather than a sample, so the margin you need to think about is the statistical one described here.

Sources

Was this explanation clear?

We use your answers to fix and expand this page.

Emma Collins

Product Analyst

Focuses on event analysis, conversion funnels, and retention, using clear metric definitions and structured analysis to explain product performance.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

How do you calculate the margin of error?

For a proportion, multiply the z-value for your confidence level (1.96 for 95%) by √(p(1 − p)/n). For a mean, use z × s/√n.

What is a good margin of error?

It depends on the decision. Polls often aim for ±3 points. For a 4% conversion rate, ±0.5 points needs about 5,900 visitors; ±1 point about 1,500.

Does a bigger sample always reduce the margin of error?

Yes, in proportion to √n: four times the sample halves the margin. It does not reduce bias or measurement errors.

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

The margin of error is half the width of the confidence interval. The interval is estimate ± margin.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics