The ABWatcher blog

How to Calculate Sample Size for A/B Tests: The Complete Formula

A step-by-step guide to calculating A/B test sample size using baseline rate, MDE, significance, and power — with real examples and benchmarks from live tests.

Maya Patel

Senior CRO Strategist · · Updated

Most failed A/B tests don't fail because the idea was bad. They fail because the test was never powered to detect the effect it was looking for. A team runs a test for two weeks, sees a "directional" 8% lift that isn't significant, ships it anyway or kills it anyway — and either decision is a coin flip. The sample size calculation is the one step that turns a test from a guess into an instrument. Skip it, and every other part of your CRO program (prioritization, roadmap velocity, stakeholder trust) inherits the noise.

This guide walks through the exact formula, the four inputs that drive it, and how to apply it using patterns we've observed in live tests at Zillow, Lever, Ally, Ro, and Monday.

TL;DR

  • Standard sample size formula requires four inputs: baseline conversion rate, minimum detectable effect (MDE), significance level (α), and statistical power (1-β).
  • Industry default is α = 0.05 (95% confidence) and power = 0.80, per Cross Validated's worked example.
  • Cutting your MDE in half roughly quadruples required sample size — the denominator is squared.
  • Lever's demo form test (detected 13 June 2026) added four fields in variant B, a change large enough to need only a modest sample to detect a real conversion-rate difference.
  • Monday's pricing test (detected 25 November 2026) ran a full server-side domain split, the kind of high-variance redesign that typically demands a larger MDE assumption to stay practical.
  • A 1-point swing in baseline conversion rate (e.g., 2% to 3%) can change required sample size by 30-40%, so stale baselines quietly invalidate pre-test math.

What is the formula for A/B test sample size?

The standard formula is n = [(Zα/2 + Zβ)² × 2p(1-p)] / d², where p is pooled conversion rate and d is minimum detectable effect.

This is the two-proportion z-test formula, and it's the one referenced across most CRO tooling, including the breakdown on Besto Calculator. Each term does specific work:

  • n — required sample size per variant (not total; double it for a two-arm test)
  • Zα/2 — z-score for your significance level (1.96 for 95% confidence, two-tailed)
  • Zβ — z-score for your statistical power (0.84 for 80% power)
  • p — pooled conversion rate, roughly the average of control and expected variant rate
  • d — minimum detectable effect, the smallest lift you actually care about catching

The numerator encodes how confident you want to be. The denominator encodes how sensitive you need the test to be. Hold the numerator constant (most teams do — 95%/80% is the de facto industry default) and the entire sample size conversation becomes about two things: your baseline rate and your MDE.

How do baseline conversion rate and MDE actually move the number?

Baseline rate and MDE interact multiplicatively, and a smaller MDE increases sample size requirements quadratically, not linearly.

Here's the mechanic that trips up most practitioners: MDE sits in the denominator, and it's squared. Halve your MDE — say, from detecting a 2-point lift to a 1-point lift — and you don't need double the traffic. You need roughly 4x the traffic. This is the single most important intuition in sample size planning, and it's why "let's just detect any improvement, however small" is not a serious test design goal for most traffic levels.

Baseline rate matters differently. Pooled conversion rate p(1-p) peaks at p = 0.5 and shrinks as you move toward 0% or 100%. Low-baseline funnels (think fintech applications, B2B demo requests) actually need proportionally less variance correction than a 50% baseline — but because the absolute MDE you can detect is also small in absolute terms, these tests still take longer in practice. GuessTheTest's breakdown is useful here for separating absolute vs. relative MDE, which is where most sample size miscalculations originate. If your baseline is 0.77% and you expect a relative 30% lift, your absolute MDE is only 0.23 points — a very different (and much larger) sample size requirement than assuming a 1-point absolute lift.

Worked example, using the standard formula at 95% confidence / 80% power:

Baseline rate MDE (absolute) Required n per variant (approx.)
3.0% 0.5 pts (relative ~17%) ~9,400
3.0% 1.0 pt (relative ~33%) ~2,400
10.0% 1.0 pt (relative 10%) ~6,900
10.0% 2.0 pts (relative 20%) ~1,730

The pattern holds across every row: shrinking the MDE you're chasing inflates the sample size far faster than baseline rate changes do. This is why scoping the MDE honestly — "what lift would actually justify shipping this?" — is a strategy decision, not a statistics one.

How does test type (layout, form, CTA, pricing) change your MDE assumptions?

The scope of the change you're testing should set your MDE expectation before you touch a calculator.

Not every test deserves the same MDE target, and conflating them is a common PIE/ICE scoring mistake. A few patterns from live tests we track at ABWatcher illustrate the range:

Layout toggles. Zillow ran a test detected 24 May 2026 toggling its 5-step BuyAbility process section (Calculate BuyAbility → Get pre-approved → Make an offer → Apply for a mortgage → Close on your home) on and off across visits. Adding or removing a full explainer section is a structural change that plausibly moves conversion by several points — a reasonable MDE target here might be 1-2 points absolute, not 0.2.

Form field changes. Lever detected a form-length test on 13 June 2026: lever.co/demo-b showed a longer form (adding Phone Number, Job Title, Company Size, Country) against the shorter four-field control on lever.co/demo. Classic friction research — HubSpot's guide notes form-length tests often produce MDEs in the 2-5 point relative range, since every added field is a known abandonment lever. This test doesn't need Zillow-scale traffic to reach significance if the effect is real.

Persistent CTA tests. Ro tested a floating "Get Started" CTA fixed to the viewport bottom, detected 26 November 2026, split via cookie-based buckets (roAB/roE1) rather than browser. Sticky CTAs are a lower-variance intervention — expect smaller lifts (often under 1 point absolute) and budget sample size accordingly, or risk under-powering the read.

Full page/brand repositioning. Monday ran a server-side split detected 25 November 2026 routing traffic between monday.com/crm/pricing (classic layout) and mondaycrm.ai/pricing (an "AI-First CRM" rebrand with different nav, no logo bar, dark "Most Popular" badging). This is effectively a new product page, not a variant — treat it like a redesign test with a larger expected MDE (3+ points) since the change bundle is large.

Card/content variant tests. Ally tested two versions of its three-card feature section below the hero, detected 26 November 2026 — one reading "Spending Account / Checking made smarter," the other restructuring around "Ally Invest / Find the right way to..." Messaging-only tests like this typically land in the moderate range, 1-3 points absolute, depending on how differentiated the copy angles are.

The takeaway: before you open a sample size calculator, classify your test by scope. Bundled redesigns can tolerate (and usually produce) bigger MDEs. Single-element tweaks need smaller MDE targets, which means more traffic and more patience.

What significance level and power should you actually use?

Use 95% confidence (α = 0.05) and 80% power (β = 0.20) as your default unless you have a specific reason to deviate.

This pairing is the convention for a reason: it balances false-positive risk against required sample size reasonably well for most consumer-scale traffic. The SplitMetrics breakdown frames the five inputs practitioners need to settle before calculating anything — control conversion rate, MDE, confidence level, power, and one- vs. two-tailed test — and significance/power are the two you should rarely touch test-to-test, because moving them erodes comparability across your testing program.

That said, there are legitimate reasons to flex:

  • High-stakes, hard-to-reverse changes (pricing page architecture, checkout flow): consider 99% confidence to reduce false-positive risk, accepting a larger sample size.
  • Low-traffic pages running frequent iterative tests: some teams accept 90% confidence / 70% power to ship faster, explicitly trading rigor for velocity — this should be a documented program decision, not an ad hoc one per test.
  • One-tailed vs. two-tailed: if you only care about detecting improvement (not regression), a one-tailed test lowers your Zα/2 and reduces required sample size — but it also means you can't statistically detect that a variant made things worse, which is a real risk for high-traffic pricing or form tests like Monday's or Lever's.

How do you apply this to your own test calendar this sprint?

Run the Confidence-Lift-Risk check before greenlighting any test: confirm your baseline is current, your MDE matches the scope of the change, and your sample size is achievable in your traffic window.

A practical pre-launch checklist:

  1. Pull a trailing 30-day baseline, not a quarter-old number. A baseline shift from 2% to 3% changes required sample size by 30-40% — stale baselines are the most common silent cause of underpowered tests.
  2. Set MDE based on test scope, using the layout/form/CTA/pricing categorization above as a starting heuristic.
  3. Calculate n per variant using the formula, or a calculator built on it — budget your own build or adapt the open-source logic referenced in the sources above.
  4. Check against actual traffic: if required sample size implies a 95-day test and your roadmap cadence is two weeks, either the MDE is unrealistic or the test doesn't belong on this page yet.
  5. Log the inputs, not just the output. When a test comes back inconclusive, the first debugging question should be "was it powered correctly?" — and you can't answer that without the original baseline, MDE, and power assumptions on record.

Common questions

How long should an A/B test run once sample size is calculated?

Duration depends on daily traffic to the tested page, not just total sample size. Divide required sample size per variant by average daily visitors per variant, and run at least one full business cycle (commonly 7-14 days minimum) to control for weekday/weekend behavior shifts, even if raw sample size is reached sooner.

Can I stop a test early if I hit significance before reaching calculated sample size?

Generally no — stopping early on observed significance inflates false-positive rates, a problem known as "peeking." If you need early-stopping flexibility, use a sequential testing method (like mSPRT) designed for it, rather than checking a fixed-horizon test daily and stopping at the first significant read.

What's the difference between absolute and relative MDE?

Absolute MDE is the raw percentage-point difference (e.g., 2% baseline to 3% variant = 1 point absolute). Relative MDE is the percentage change versus baseline (that same move is a 50% relative lift). Confusing the two is a leading cause of miscalculated sample sizes — always specify which one you're using.

Does sample size calculation differ for mobile app A/B tests versus web?

The formula itself doesn't change, but mobile tests often have smaller usable samples due to app store review cycles limiting iteration speed and fragmented OS/device segmentation diluting per-segment sample size. Teams typically compensate by widening MDE targets or extending test duration rather than changing the underlying statistics.

Should I recalculate sample size if I add a third variant?

Yes — adding variants (A/B/C/n tests) requires either a larger total sample size to maintain power per comparison, or a Bonferroni-style correction to your significance threshold to control for multiple comparisons. Three-arm tests at the same per-arm sample size as a two-arm test are effectively underpowered against the original plan.

Pick one test currently on your roadmap, pull its real baseline from the last 30 days, and run the formula before you write the brief. If the implied sample size doesn't fit your traffic and timeline, that's information worth having before launch, not after a null result.

Read next

More from the ABWatcher blog

From the glossary

Vocabulary the article uses. See all terms →

  • Blind Spot Bias— The tendency for testing programs to repeatedly overlook certain page areas, segments, or failure modes because past wins trained teams where to look.
  • Lift Decay— The gradual shrinking of a winning variant's measured uplift as it runs longer or scales to full traffic.
  • Pre-Post Bias— The distortion that arises when comparing a test period to an earlier period instead of a concurrent control, confounding results with time-based changes.
  • Above Threshold Bucketing Error— A misconfiguration where users are assigned to the wrong variant because allocation logic misreads a threshold or percentage boundary.
  • Experiment Register— A centralized, living log of all experiments run across an organization, including status, hypothesis, results, and owner.
  • Experiment Allocation Imbalance— An unintended skew in traffic split between variants that isn't severe enough to flag as SRM but still distorts results.

See more like this

ABWatcher catches A/B tests like this across 1,000+ brands.

Watch live experiments at 1,000+ high-converting brands, complete with hypothesis and takeaway. 7 days of Pro, free, no card, then Free forever for ten watched companies.