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 current conversion rate for the population you plan to test. Required sample size depends on this rate and the absolute change you want to detect.
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: Choose MDE from the decision you need to make. A larger MDE reduces sample requirements but lowers your chance of detecting smaller effects.
A 5% significance level and 80% power are common planning choices. Choose them before the test based on the costs of false positives and missed improvements.
Formula
Alpha = 0.05, Beta = 0.20, Power = 1 - Beta = 0.80Pro tip: Raising alpha from 0.05 to 0.10 permits a higher false-positive rate. Do not change the threshold after seeing the results.
Sample-size calculations combine baseline, MDE, significance, and power. The approximation below assumes a two-sided test, 95% confidence, 80% power, and equal allocation between two variants. Calculators can use more detailed approximations.
Formula
N per variant ≈ 16 x p x (1 - p) / (p x relative MDE)^2; use decimalsPro 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: For a fixed-sample test, wait for the planned sample and duration. If you need valid early stopping, use a method designed for repeated checks.
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.
Plan the sample size before a fixed-sample test so you know whether available traffic can detect an improvement worth acting on. Other designs, such as sequential tests, need their own stopping rules.
Consider a larger MDE only if detecting smaller effects is unnecessary, a longer test if conditions can stay stable, or a higher-traffic surface relevant to the same question. Make trade-offs before launch.
The formula above is for binary outcomes such as conversion. Continuous metrics such as revenue per user need a calculation that uses their variability. PM Toolkit’s sample-size calculator plans binary-outcome tests.
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.