Skip to content
Omnikalc

A/B test sample size and duration

Find how many visitors each variant needs to detect a given lift in conversion rate, and how long the test must run at your traffic.

Updated on
Your inputs
%

Value out of range

%

Value out of range

Test type
%

Value out of range

Value out of range

Value out of range

Results

Visitors needed per variant

8,158

Days needed at this traffic

9

Total visitors for the test
16,316
Conversion rate to detect in the variant
6.00%
Absolute difference to detect
1.00%

Why sample size matters in A/B testing

An A/B test compares a control page (A) with a variant (B). Stop it too early and you risk a false winner; run it too small and a real improvement goes unnoticed. Deciding the sample size before the test fixes both problems and tells you how long the test must run.

The inputs

  • Baseline conversion rate: the current rate of the control, such as 5% of visitors who buy.
  • Minimum detectable effect (MDE): the smallest relative lift worth detecting, such as +20% (from 5% to 6%).
  • Significance level α: usually 5%, the risk of declaring a winner that is not one.
  • Power: usually 80%, the chance of detecting the effect if it is real.

The formula

For two proportions p₁ and p₂, with p̄ = (p₁ + p₂) ÷ 2, each group needs:

n = [z₁₋α/₂ √(2p̄(1 − p̄)) + z₁₋β √(p₁(1 − p₁) + p₂(1 − p₂))]² ÷ (p₂ − p₁)²

Example

Baseline 5%, MDE +20% relative, α = 5% two-tailed, 80% power, 2,000 visitors a day split between two variants:

  • target rate: 6%, an absolute difference of 1 point;
  • 8,158 visitors per variant, 16,316 in total;
  • at 2,000 visitors a day: 9 days. Round up to 14 days to cover two full weeks.

What drives sample size

  • Smaller effects need many more visitors: halving the MDE roughly quadruples the sample. Detecting +10% instead of +20% here would take about 31,000 visitors per variant.
  • Lower baseline rates need larger samples for the same relative lift.
  • More variants multiply the total traffic needed, and call for a correction such as Bonferroni.

Good practice

  • Do not peek and stop as soon as p < 0.05: repeated checking inflates false positives. Wait for the planned sample, or use a sequential testing method designed for early stopping.
  • Run tests over whole weeks, since behavior differs between weekdays and weekends.
  • Choose the MDE from business value: what lift would justify shipping the change?
  • Check that the traffic split is as planned (a sample ratio mismatch suggests a bug).

When the test ends, the A/B test significance calculator gives the p-value and confidence interval of the observed difference.

Frequently asked questions

How many visitors do I need for an A/B test?

It depends on the baseline conversion rate, the smallest lift you want to detect, the significance level and power.

What is minimum detectable effect?

The smallest relative improvement the test can reliably detect. Smaller effects need far more traffic.

Why use 80% power?

It is a common compromise: 80% chance of detecting a real effect of the chosen size without huge samples.

Can I stop a test early when it looks significant?

Not safely. Peeking inflates false positives; run until the planned sample size is reached.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.