CalculatorMasters

A/B Testing Sample Size Formula

Learn how an A/B test sample size and estimated monthly test duration are calculated from conversion rate, uplift, confidence, power, and traffic.

This calculator estimates the visitors needed to compare one control version with one variant. It helps determine whether available eligible monthly traffic is sufficient to detect a selected conversion-rate uplift at the chosen confidence and statistical power.

  • 100% Free
  • No Sign-Up Required
  • Private & Secure
  • Mobile Friendly

Required Visitors per Variant

n = ceil((z_confidence × √(2p̄(1 − p̄)) + z_power × √(p₁(1 − p₁) + p₂(1 − p₂)))² ÷ (p₂ − p₁)²)

Where:

The formula estimates the number of visitors needed in each version by comparing the baseline conversion probability with the expected variant probability. Smaller differences and stricter confidence or power settings increase the required sample.

Variables Explained

VariableWhat It MeansUnit
n - Required visitors per variantEstimated number of eligible visitors needed in the control group and separately in the variant group.visitors
p₁ - Baseline conversion probabilityThe control conversion rate expressed as a decimal probability.percent
p₂ - Expected variant conversion probabilityThe baseline probability after applying the selected relative uplift.percent
- Average conversion probabilityThe average of the baseline and expected variant probabilities.percent
z_confidence - Confidence z-scoreThe z-score representing the selected two-sided confidence level, such as 1.96 for 95%.N/A
z_power - Power z-scoreThe z-score representing the selected statistical power, such as 0.84 for 80%.N/A
d - Conversion-rate differenceThe absolute decimal difference between the expected variant and baseline conversion probabilities.percent
V - Eligible monthly visitorsThe visitors expected to enter the experiment each month after applying the test traffic share.visitors

Step-by-Step Calculation

1

Convert the baseline rate to a probability

A displayed percentage such as 3% becomes 0.03 for use in the calculation.

baselineRate = baselineConversionRate / 100

2

Calculate the expected variant rate

The minimum detectable uplift is relative to the baseline. A 10% uplift on a 3% baseline produces a 3.3% expected variant rate.

variantRate = baselineRate * (1 + minimumDetectableUplift / 100)

3

Find the average and difference in rates

The average rate is used in the variance estimate, while the difference is the effect the test is designed to detect.

averageRate = (baselineRate + variantRate) / 2; conversionRateDifference = variantRate - baselineRate

4

Calculate visitors needed in each variant

This two-proportion approximation estimates the sample for a 50/50 control-versus-variant test and rounds up to a whole visitor.

sampleSizePerVariant = ceil(pow(confidenceZScore * sqrt(2 * averageRate * (1 - averageRate)) + powerZScore * sqrt(baselineRate * (1 - baselineRate) + variantRate * (1 - variantRate)), 2) / pow(conversionRateDifference, 2))

5

Calculate total visitor requirement

Both the control and variant need the calculated sample size.

totalRequiredVisitors = sampleSizePerVariant * 2

6

Estimate the duration in months

The combined sample requirement is divided by monthly traffic that is actually eligible for the experiment.

eligibleMonthlyVisitors = monthlyVisitors * testTrafficShare / 100; estimatedTestMonths = totalRequiredVisitors / eligibleMonthlyVisitors

Example: 3% baseline rate and 10% detectable uplift

Baseline conversion rate3%
Minimum detectable uplift10%
Confidence z-score1.96 (95% two-sided)
Power z-score0.84 (80% power)
Monthly visitors100,000 visitors
Traffic included in test100%
1

Convert the baseline rate

3 / 100

0.03

2

Calculate the expected variant rate

0.03 × (1 + 10 / 100)

0.033

3

Find the detectable difference

0.033 − 0.03

0.003

4

Calculate the sample per variant

ceil((1.96 × sqrt(2 × 0.0315 × 0.9685) + 0.84 × sqrt(0.03 × 0.97 + 0.033 × 0.967))² / 0.003²)

53,151 visitors per variant

5

Calculate total visitors

53,151 × 2

106,302 visitors

6

Estimate duration

106,302 / (100,000 × 100 / 100)

1.1 months

Final Result

The test needs about 53,151 visitors in each variant, 106,302 visitors in total, and approximately 1.1 months at the stated eligible monthly traffic.

Try the Calculator →

Assumptions

  • The experiment has exactly two versions: one control and one variant.
  • Eligible traffic is allocated evenly, with approximately 50% assigned to each version.
  • The confidence z-score represents a two-sided comparison of conversion rates.
  • The baseline conversion rate, visitor mix, and traffic quality remain reasonably stable while the test runs.
  • Monthly eligible traffic is representative of the traffic available during the experiment.

Limitations

  • !This is a planning approximation and does not guarantee a statistically valid or commercially useful outcome.
  • !Uneven allocation, multiple variants, repeated interim checks, and multiple metrics may require a different design and more traffic.
  • !Seasonality, campaigns, product changes, tracking changes, or audience shifts can make actual duration differ from the estimate.
  • !Very low conversion rates and very small effects may be sensitive to modeling choices and data-quality issues.

Common Mistakes to Avoid

1

Entering an absolute percentage-point change as though it were a relative uplift; a 10% uplift on a 3% baseline means 3.3%, not 13%.

2

Using total site traffic instead of the visitors who are eligible to enter the experiment.

3

Assuming the monthly duration is per variant rather than based on total eligible traffic split between both variants.

4

Choosing a very small uplift without recognizing that it can substantially increase the required sample.

5

Stopping as soon as an interim result looks positive instead of following a preplanned analysis approach.

Related Formulas

Frequently Asked Questions

What is the A/B testing sample size formula?

It is a two-proportion sample-size approximation that uses the baseline conversion probability, expected variant probability, confidence z-score, and power z-score to estimate visitors required in each group.

How do I calculate a 10% uplift from a 3% conversion rate?

Multiply 3% by 1.10. The expected variant rate is 3.3%, which is a 0.3 percentage-point absolute increase.

Why does the formula use both confidence and power?

Confidence controls the selected false-positive threshold, while power represents the chance of detecting the planned effect if it exists. Higher settings generally require more visitors.

Why is required sample size rounded up?

A partial visitor is not possible, and rounding up avoids understating the target sample.

How is A/B test duration in months calculated?

The calculator divides total required visitors across both variants by the number of eligible visitors expected to enter the test each month.

Does this formula work for multivariate or multi-variant tests?

No. It is designed for a single control and one variant with equal allocation. More variants usually require a different analysis plan.

Ready to calculate your result?

Use the calculator to get instant results with your own inputs.

Try A/B Testing Sample Size