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
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.
Formula
Baseline conversion rate = converters / users in the qualifying periodPro tip: Beware of seasonality. A baseline pulled from Black Friday week will overstate normal performance.
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.
Formula
MDE = relative percentage change you want the test powered to detectPro 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.
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.
Formula
Alpha = 0.05, Beta = 0.20, Power = 1 - Beta = 0.80Pro 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.
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.
Formula
Required N per variant approx. 16 x baseline x (1 - baseline) / (baseline x MDE)^2Pro tip: Cutting off a few hundred users to make the number fit silently lowers your power. Always round up.
Sample size tells you how many users you need. Duration tells you how long that will take at your traffic.
Formula
Test duration in days = total required sample size / eligible daily usersPro 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.
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 CalculatorAbsolute 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.
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.
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.
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.
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.