DevTools Logo

A/B Test Sample Size Calculator

A/B Test Sample Size Calculator

Size an experiment from baseline rate, minimum detectable effect and power — with duration and a sensitivity table.

Runs in your browser
Try an example

Experiment inputs

Two-sided z-test · unpooled variance

Assumptions

Two-sided test, equal allocation for the headline n, conversion-rate (binomial) metric, unpooled variance p₁(1−p₁)+p₂(1−p₂), no sequential testing or CUPED adjustment. Bonferroni uses k−1 comparisons against control.

Result

alpha 0.05000 · power 0.8

n / variant

31,231

Total sample

62,462

Target rate

5.50%

Duration

2 d

Rounded to full weeks: 7 days. Implied lift: 10.0%.

Sensitivity — relative MDE

MDELiftn / variantDaysLoad
2%2.0%752,70031
5%5.0%122,1215
10%10.0%31,2312
20%20.0%8,1551

n = (z(0.0500000/2) + z(0.800000))² × [0.0500×0.9500 + 0.0550×0.9450] / (0.0050)²

The calculator solves the standard two-sided two-proportion z-test: n = (z(α/2) + z(1−power))² × (p₁(1−p₁) + p₂(1−p₂)) / (p₁−p₂)². Enter a baseline rate, a relative or absolute minimum detectable effect, a significance level and a power target to get the equal-allocation sample per arm, total sample, implied lift and duration at your daily traffic. Multiple variants apply a Bonferroni correction across k−1 comparisons against control, and unequal traffic splits are costed with the allocation-weighted total. A sensitivity table shows 2%, 5%, 10% and 20% relative effects under the same settings. All math is textbook pre-test sizing — no sequential or Bayesian corrections are applied.

Classic checkout experiment

baseline 5% · relative MDE 10% · alpha 0.05 · power 80% · 50,000 visitors/day

Target rate 5.5%; roughly 31,231 users per variant, 62,462 total, about 2 days at 50,000 visitors per day.

Absolute percentage-point effect

baseline 5% · absolute MDE 0.5 pp · alpha 0.05 · power 80%

Absolute mode takes the effect directly in percentage points: 5% → 5.5%, the same target as a 10% relative lift.

Three-arm test with Bonferroni

variants 3 · split 34/33/33 · alpha 0.05

Two treatment arms are compared with control, so alpha becomes 0.025 per comparison and the required sample grows.

Examples

Checkout flow

Input
baseline 5%, relative MDE 10%, alpha 0.05, power 80%, 50,000 visitors/day
Output
31,231 per variant · 62,462 total · 2 days

The canonical fixture: a 10% relative lift on a 5% baseline means a 5.5% target.

Power upgrade

Input
same parameters, power 90%
Output
about 41,700 per variant

Higher power reduces false negatives at the cost of a larger sample.

80/20 split

Input
variants 2, split 80, 20, daily visitors 50,000
Output
larger total than equal allocation

The minority arm's variance has to be divided by its 20% allocation, so the weighted total grows.

Impractical effect

Input
baseline 5%, relative MDE 1%
Output
over 10 million per arm with an impractical-warning

Halving the detectable effect roughly quadruples the required sample.

About this tool

The A/B Test Sample Size Calculator answers the question every experiment owner asks before launch: how many visitors do we need, and how long will that take? Enter a baseline conversion rate, a minimum detectable effect (relative percent or absolute percentage points), a significance level and a power target. The tool solves the two-sided two-proportion z-test and reports the equal-allocation sample per arm, the total sample, the implied lift and the runtime at your daily traffic.

The math is shown, not hidden. The quantile constants for the standard alpha and power presets are bundled, the unpooled variance formula is printed with your numbers substituted, and a sensitivity table compares 2%, 5%, 10% and 20% relative effects under the same settings. Three or more variants apply a Bonferroni correction across k−1 comparisons against control; unequal traffic splits are costed by the allocation-weighted total, so an 80/20 split is not mistaken for a 50/50 test.

This is pre-test planning only. It does not compute p-values from results, support sequential testing or CUPED variance reduction, or model non-binomial metrics. All computation runs in your browser.

What this tool does not do

  • Fixed-horizon, two-sided z-test only; no sequential, Bayesian or one-sided designs.
  • Applies to binomial conversion metrics, not continuous or revenue-per-user metrics.
  • Bonferroni is conservative; Dunnett or Holm corrections are not implemented.
  • Target rates are clamped to 0.01%–99%; extreme rates distort the normal approximation.
  • Duration assumes steady daily traffic and full-week rounding is a suggestion, not a guarantee.

How to use this tool

  1. Set the baseline

    Enter the current conversion rate as a percent. It must be strictly between 0 and 100.

  2. Choose an effect

    Pick relative % (10 means a 10% lift over baseline) or absolute pp (0.5 means 5% to 5.5%).

  3. Pick alpha and power

    Alpha 0.05 and power 80% are common defaults; stricter alpha, higher power or a smaller effect all increase the sample.

  4. Add traffic and variants

    Enter total daily visitors and a traffic split with one percentage per variant, summing to 100.

  5. Read the table

    Use the sensitivity rows to see what is affordable, and click Use to load a row's effect into the inputs.

Use cases

Plan a launch

Decide whether a proposed lift can be measured within a sprint or a quarter.

Validate a platform estimate

Cross-check the sample size an experimentation platform suggests before committing traffic.

Compare effect sizes

Use the sensitivity table to see which effects are affordable at current traffic.

Teach experiment design

Show the z-test formula, quantile constants and Bonferroni adjustment with concrete numbers.

Settings and their effect on n

SettingMeaning
Baseline rateCurrent conversion probability p₁, as a percentage.
Relative MDETarget p₂ = p₁ × (1 + MDE/100); 10 on a 5% baseline means 5.5%.
Absolute MDETarget p₂ = p₁ + MDE/100; 0.5 on a 5% baseline means 5.5%.
AlphaTwo-sided false-positive rate; 0.05 gives z(α/2) = 1.959964.
PowerChance to detect a true effect; 80% gives zβ = 0.841621.
BonferroniWith k variants, alpha is divided by k−1 control comparisons.
Durationceil(total required sample / daily visitors), rounded up to full weeks in the note.

Variance is unpooled: p₁(1−p₁) + p₂(1−p₂). Results are for a fixed-horizon test only.

Common mistakes

Mistake:Entering 0.05 for a 5% baseline.

Fix:The baseline field takes percentages, so enter 5.

Mistake:Confusing relative and absolute MDE.

Fix:10% relative means 5% to 5.5%; 0.5 pp absolute means the same target — the fields are not interchangeable.

Mistake:Assuming duration is n per variant divided by total daily traffic.

Fix:Use total sample over total daily traffic; the tool already costs your allocation split.

Mistake:Expecting a result for a zero effect.

Fix:A zero MDE requires infinitely many samples; the tool reports an error instead.

Mistake:Treating the number as a guarantee.

Fix:The estimate assumes a fixed-horizon, equal-variance binomial model with no sequential peeking.

Frequently asked questions

What is minimum detectable effect?

MDE is the smallest true difference you want the experiment to be able to detect. In relative mode, 10% on a 5% baseline means a 5.5% target; in absolute mode you enter the percentage-point gap directly, so 0.5 means the same 5% to 5.5% change.

What power should I use?

80% is the common default: if the effect is real, the test has an 80% chance of reaching significance. Use 90% or 95% when a false negative would be costly — the sample size grows accordingly.

Why does a smaller MDE need more samples?

Signal grows with the effect size while noise grows with the square root of the sample. The formula divides by the squared difference, so halving the MDE roughly quadruples the required sample.

How do I calculate test duration?

Divide the total required sample by total daily visitors and round up. The tool also shows a full-week rounding suggestion so weekday/weekend seasonality is less likely to skew the result.

What about multiple variants?

With three or more arms including control, the tool applies a Bonferroni correction: alpha is divided by the number of treatment-vs-control comparisons (k−1). That is conservative but keeps the false-positive rate under control.

Does an 80/20 split need more traffic?

Yes. With unequal allocation the smaller arm contributes disproportionately to variance, so the allocation-weighted total is larger than a 50/50 test. The tool reports the total and per-arm sizes using the correct weighted formula.

Can it analyse results or p-values?

No. This is pre-test sizing only. It does not compute significance from observed data, support sequential peeking, or apply CUPED and other variance-reduction techniques.

References & standards