← Growth guides

Course chapter: CRO

A/B test sample size: how many visitors you need

An A/B test needs enough visitors in each variation to separate a true difference from noise. With too few, the result cannot be trusted either way. This guide covers how to work out the sample size before a test starts and how to turn it into a test length.

The inputs

Sample size depends on four numbers:

  • 01Baseline conversion rate: how often the current version converts.
  • 02Minimum detectable effect: the smallest change you care about detecting, stated as an absolute or relative change.
  • 03Significance level (alpha): how often you accept a false positive. 5% is the common default.
  • 04Statistical power (1 − beta): how often the test detects the effect if it exists. 80% is the common default.

A rule of thumb

Evan Miller gives a rule of thumb for the sample size per variation: n = 16σ² ÷ δ², where δ is the minimum effect you want to detect and σ² is the expected variance. [1] For a conversion rate p, the variance is p × (1 − p).

A hypothetical example: a signup page converts at 10%, and the team wants to detect an absolute lift of 2 percentage points. Variance is 0.1 × 0.9 = 0.09. The rule gives 16 × 0.09 ÷ 0.0004 = 3,600 visitors per variation, or 7,200 for an A/B test with two variations.

For exact numbers, use a calculator such as Evan Miller's, which takes the baseline, effect, power and significance and returns visitors per variation. [2]

Why small effects need large samples

The effect size sits squared in the denominator. Halving the minimum detectable effect from 2 points to 1 point multiplies the sample size by four. Low-traffic pages often cannot detect small changes in a reasonable time, so test bigger changes on them, such as a new offer or page structure, rather than button colors.

Do not stop early

Evan Miller's essay How Not To Run an A/B Test explains that checking results repeatedly and stopping when they look significant inflates the false positive rate. [1] His example: if you peek at an ongoing experiment ten times, what looks like 1% significance is closer to 5%. [1]

His recommended fix is to decide on a sample size in advance and wait until the experiment reaches it before trusting the result. [1] If you need to monitor tests continuously, use a method built for it, such as sequential testing, instead of a fixed-sample test read early.

Turn sample size into test length

Divide the total sample by the daily traffic that reaches the test. If 600 visitors a day reach the signup page, 7,200 visitors take 12 days. Round up to whole weeks so weekday and weekend behavior are both included, which makes this example a two-week test.

If the length comes out at several months, change the plan: raise the minimum detectable effect, test on a higher-traffic page, or pick a metric closer to the change you made.

Write it down first

Before launch, record the hypothesis, the primary metric, the minimum detectable effect, the sample size and the end date. Writing it down helps the team stick to the plan when early results look exciting.

Learn it by playing it

The course teaches growth through simulations and decisions you make.

Play Chapter 1 free→

Common questions

How many visitors do I need for an A/B test?
It depends on your baseline conversion rate and the smallest effect you want to detect. Use a sample size calculator before you start, and expect small effects to need large samples.
Can I stop a test as soon as it is significant?
Not with a standard fixed-sample test. Stopping on a significant peek inflates false positives. Decide the sample size in advance or use a sequential method.
How long should an A/B test run?
Until it reaches the planned sample size, rounded up to full weeks so it covers weekday and weekend behavior.

Sources

  1. 1.How Not To Run an A/B Test · Evan Miller
  2. 2.Sample Size Calculator · Evan Miller

More guides