A/B Test Sample Size: Choose the Effect, Power and Stopping Rule Before Launch
Plan a two-variant conversion experiment with explicit baseline, absolute effect, power and allocation. Estimate eligible sample and duration, and distinguish fixed-horizon testing from valid sequential monitoring.
The short answer
Define the experimental unit, primary outcome, baseline rate, effect worth detecting, significance level and power before choosing sample size. Use a calculation matched to the design and a prespecified stopping rule. A small p-value is not proof of a worthwhile business effect, and a nonsignificant result is not proof of no difference.
Key takeaways
- Define independent units and conversion windows.
- Distinguish relative lift from absolute effect.
- Use a design-matched power calculation.
- Prespecify fixed or sequential stopping.
- Report effect uncertainty and practical value.
Direct answer: Define the experimental unit, primary outcome, baseline rate, effect worth detecting, significance level and power before choosing sample size. Use a calculation matched to the design and a prespecified stopping rule. A small p-value is not proof of a worthwhile business effect, and a nonsignificant result is not proof of no difference.
Specify what is randomized and measured
For a conversion test, identify unique eligible users or accounts rather than treating every page view as independent. Keep assignment stable and define the conversion window. Repeated visits, account-level treatment and clustered outcomes change the effective information in the sample.
Separate an absolute percentage-point change from a relative lift. Moving from 4.0% to 4.4% is a 0.4-point absolute increase and a 10% relative increase. Choose the alternative effect based on decision value and feasible traffic; it is not a promise that the treatment will achieve it.
Use a transparent approximation
For two independent, equally sized groups, a common normal approximation is n per group = [zα × √(2p̄(1−p̄)) + zβ × √(p1(1−p1)+p2(1−p2))]² / (p2−p1)², where p̄ is the average of the two rates. For a two-sided 5% test and 80% power, rounded z values are 1.96 and 0.84.
The Penn State power notes describe proportion comparisons and their assumptions. This planning approximation does not include continuity correction, clustering, attrition or multiple-comparison adjustments; use a validated implementation matched to the final test.
Calculate two hypothetical planning targets
At p1 = 0.04 and p2 = 0.044, the formula gives about 39,430.10 per group, rounded up to 39,431. Total enrollment is 78,862. At 5,000 eligible independent users per day split evenly, enrollment takes about 15.77 days before allowing for conversion follow-up.
For a 5% relative lift to 4.2%, the same rounded-z calculation gives about 154,129.30 per group, rounded to 154,130. Total enrollment is 308,260, or about 61.65 days at that traffic. Halving the effect roughly quadruples the requirement; changing variance means the factor is not exactly four.
Decide how monitoring affects inference
For a fixed-horizon design, do not stop for success whenever an ordinary p-value first falls below 0.05. Repeated significance-based stopping changes the false-positive properties. A valid sequential design can support planned repeated looks, but its rules must be chosen and applied correctly.
Monitor instrumentation, allocation balance, severe harm and operational failures throughout. Those checks are necessary even when the inferential decision waits. Multiple variants, metrics or exploratory segments require appropriate interpretation and, where relevant, multiplicity control.
Report the estimate and its practical uncertainty
Plan duration around relevant business cycles and follow-up, not an automatic three-week rule. Exclude only according to defensible prespecified criteria and investigate sample-ratio mismatch or missing outcomes.
At the end, report effect size, uncertainty, guardrails and limitations. Consider implementation cost and whether the confidence interval includes economically unimportant or harmful effects. Power is the probability of detecting the specified alternative under the design, not the probability that a significant result is true.
Continue the analysis
Your checklist
- Specify baseline, effect, alpha and power.
- Account for allocation and clustering.
- Estimate eligible traffic and follow-up time.
- Predefine outcomes and stopping rules.
- Check assignment, data quality and guardrails.
Common questions
Can a team look at results during a fixed-horizon test?
It can monitor data quality and safety. Repeatedly using ordinary significance tests to stop for success changes the inference unless the method accounts for those looks.
Sources & further reading
- Penn State STAT 507: Power and sample size
Power calculations for comparing proportions depend on baseline, alternative, allocation, significance level and power.