Step-by-Step Guide

How to Calculate A/B Test Sample Size

Follow these 5 steps to calculate the sample size you need before running an A/B test. Includes formulas, defaults, and tips for product managers.

Last updated: April 2026

1
Estimate your baseline conversion rate

The baseline is the rate the control variant converts at today. Sample-size math starts here because tests are easier to detect on either very low or very high baselines than on middling ones.

Pull at least four weeks of historical conversion data.
Use the same definition you’ll use during the test.
Match the user segment that will see the test, not your global rate.
Use the most recent stable period if rates have been moving.

Formula

Baseline conversion rate = converters / users in the qualifying period

Pro tip: Beware of seasonality. A baseline pulled from Black Friday week will overstate normal performance.

2
Decide your minimum detectable effect (MDE)

MDE is the smallest improvement you want the test to be able to detect. Set it before the test starts. A smaller MDE needs a much bigger sample.

1-2% relative lift is hard to detect even on high-traffic sites.
5% relative lift is the common sweet spot for mature optimization programs.
10-15% MDE is workable when you have less traffic.
Set MDE based on the smallest improvement worth shipping for, not your hopes.

Formula

MDE = relative percentage change you want the test powered to detect

Pro tip: Most trustworthy tests don't yield more than a 5% relative conversion lift, so an MDE above that range will leave you under-powered for typical results.

3
Pick your significance and power thresholds

These are the two statistical defaults that almost every reputable A/B testing tool starts with. Stick with them unless you have a specific reason to deviate.

Alpha = 0.05 (5% chance of a false positive).
Beta = 0.20, so power = 0.80 (80% chance of detecting a real effect at the MDE).
Optimizely, VWO, and most academic guides default to 95% significance and 80% power.

Formula

Alpha = 0.05, Beta = 0.20, Power = 1 - Beta = 0.80

Pro tip: Don't lower alpha to 0.10 to speed up tests. You'll inflate your false-positive rate and ship changes that don't actually work.

4
Apply the formula or use the planning calculator

Sample-size formulas combine baseline, MDE, alpha, and beta to give you the users-per-variant target. The math is the same whether you use a formula or a calculator.

Plug your baseline, MDE, alpha, and beta into a sample-size calculator.
The output is required sample size per variant.
Multiply by the number of variants for the total required sample.
Always round up.

Formula

Required N per variant approx. 16 x baseline x (1 - baseline) / (baseline x MDE)^2

Pro tip: Cutting off a few hundred users to make the number fit silently lowers your power. Always round up.

5
Convert sample size into a test duration

Sample size tells you how many users you need. Duration tells you how long that will take at your traffic.

Pull your daily eligible traffic for the test surface.
Divide required sample size by daily traffic to get days needed.
Add a buffer to cover at least one full business cycle (minimum 7 days).
Example: 62,000 users at 4,000 per day = roughly 16 days.

Formula

Test duration in days = total required sample size / eligible daily users

Pro tip: Never end a test early because the dashboard is showing significance. Underpowered tests at standard significance produce spurious early wins. Wait for the planned sample.

Plan Your A/B Test in Seconds

Skip the manual math. Our free sample-size calculator ships with defaults for alpha, power, and MDE, plus a duration estimator.

Open Free Sample Size Calculator

Frequently Asked Questions

What's the difference between absolute and relative MDE?

Absolute MDE is a percentage-point change. Relative MDE is a percentage of the baseline. A baseline of 5% with a 10% relative MDE means you can detect a lift to 5.5%. The same 10% as absolute MDE would mean detecting a lift to 15%, which is a much bigger swing. Most sample-size calculators default to relative MDE because it's how product teams actually think about lift.

Can I run an A/B test without calculating sample size?

You can, but you shouldn't. Tests without a planned sample size invite peeking, early stopping, and false positives. Spending five minutes on the math up front saves weeks of arguing about whether a result is real.

What if I don't have enough traffic to hit the required sample size?

Three options. Increase the MDE you're willing to accept. Run the test longer so the sample grows. Or pick a higher-traffic surface where the baseline lift opportunity is bigger. Don't lower alpha or power to make the math work.

Does the formula work for non-binary metrics?

The z-test formula above is for proportions like conversion rate. For continuous metrics such as revenue per user, use a t-test sample-size formula that accounts for the metric's variance. Most calculators have separate modes for proportions and continuous metrics.

Do I need to recalculate if my baseline changes during the test?

No. Lock the design at test start. If the baseline shifts dramatically, that's a signal to rerun the test under the new conditions, not to adjust mid-flight.