How to Calculate Sample Size for A/B Testing

H
Hesaplamasyon Team
•2026-10-09
How to Calculate Sample Size for A/B Testing
Interactive Calculation Tool

A/B Test Sample Size and Power Calculator

Calculate sample size and test duration for comparing two independent binary conversion rates before running an experiment.

Go to Calculator / Calculate Now→

How to Calculate Sample Size for A/B Testing

A/B testing is a fundamental method used in digital product development to separate ideas from assumptions and base them on concrete data. However, for a test to be considered successful, the results obtained must be statistically significant. The way to achieve statistical significance is by using a correctly calculated sample size. So, how do you calculate how many users you need before starting a test?

By using our A/B Test Sample Size and Power Calculator, you can quickly plan with your own data.

Why Do We Need Pre-Test Calculations?

Many marketers and product managers start a test, wait until the results look favorable (peeking), and then end the test. This is a massive mistake that incredibly increases the Type I error (false positive) rate. Sample size calculation must be completed before starting the test, and the test's results shouldn't be declared a "winner" until the targeted number is reached.

Knowing the correct sample size prevents you from wasting resources (time and traffic) and stops you from implementing a wrong decision as if it were correct.

Parameters Used in Calculation

When calculating the number of participants required for an A/B test, you need to know the following four basic components:

  1. Control Group Conversion Rate (Baseline): The success metrics of the current situation. If the click-through rate of a button is 4%, the base rate of the page or element you will test is considered 4%.
  2. Minimum Detectable Effect (MDE): The smallest amount of change that will be considered meaningful for your business. If you want to increase the 4% conversion to 4.5% (an absolute 0.5% increase), your MDE is shaped accordingly.
  3. Statistical Significance (Alpha): Usually set at 0.05. It determines your risk of arriving at the "there is a difference" conclusion purely by chance when there is actually no difference.
  4. Statistical Power (Power): Usually set at 80% (0.80). It is the capacity of your test to catch a difference when there is genuinely one.

Mathematical Background: How the Formula Works

The standard approach for calculating A/B test sample size relies on comparing two independent proportions. The general formula, derived using the Z-distribution and variance, is as follows:

General formula (For equal group sizes):
Sample size per group (n) = $2 * (Z_{\alpha/2} + Z_{\beta})^2 * p * (1-p) / \delta^2$

Here:

  • $Z_{\alpha/2}$ and $Z_{\beta}$ are Z-scores taken from the standard normal distribution table.
  • $p$ is the combined pooled proportion of the two groups.
  • $\delta$ is the difference between the groups (MDE).

Example Scenario:
Let your current landing page conversion rate be 10%. You expect your new design to increase this to 12%. So MDE = 2%. When alpha is 5% and power is 80%; $Z_{\alpha/2} = 1.96$ and $Z_{\beta} = 0.84$. The pooled proportion becomes p = 0.11.
When you plug these values into the formula, you see that approximately 3,843 people (a total of ~7,686) are needed for each group.

The Impact of Daily Traffic on Test Duration

Finding the sample size is just the first step; the next step is determining how long the test will take. Let's say your daily traffic is 500 people. 7,686 / 500 = Approximately 15.3 days. You should always round this duration up to multiples of weeks (for example, 14, 21, 28 days). Why? Because the purchasing behaviors of your weekday visitors are different from those arriving on a Sunday evening. Completing weekly cycles ensures you reflect this seasonal fluctuation equally on both groups of the test.

To plan your own scenario instantly without dealing with calculations, you can use our A/B Test Sample Size and Power Calculator page and take your first step towards reliable optimization processes.

Industry-Specific Approaches to Sample Size

The required sample size for A/B testing can vary greatly depending on the industry in which the test is conducted. For example, in a high-traffic e-commerce site, conversion rates are typically low (between 1% and 3%), so detecting a very small increase (e.g., 0.1%) might require hundreds of thousands of visitors. On the other hand, in a B2B SaaS platform or a B2B service company's website, the baseline conversion rate might be higher, but the traffic is significantly lower. In such cases, more pronounced changes should be tested, and a larger MDE should be targeted. Otherwise, reaching the sample size that makes the test statistically significant could take months, meaning a massive waste of time for the company.

Types of Errors and Their Practical Impacts

To better understand the concepts of statistical power and significance level, we must take a closer look at Type I and Type II errors. A Type I error (False Positive) occurs when the test suggests an improvement even though there is no real change. The significance level (alpha), typically set at 5%, represents our probability of making this error. Lowering this rate prevents bad investments but increases the required sample size. A Type II error (False Negative), on the other hand, is the failure to detect a benefit that actually exists. Having 80% power means we are willing to accept a 20% chance of making this error. If companies have invested heavily in a new feature, they might increase power to 90% to avoid discarding a good investment. However, this will again raise the sample size requirements.

Practical Significance of Test Results

It is not only statistical significance that matters, but also practical significance. In a massive sample size of hundreds of thousands of people, even a 0.01% increase in conversion rate might appear statistically significant (p < 0.05). However, deploying this change to production comes with engineering costs. The MDE (Minimum Detectable Effect) chosen during planning should be "the smallest gain that makes implementing this change worthwhile." Achieving a mathematically significant result does not mean the commercially correct move was made. Therefore, when calculating sample size, a realistic MDE aligned with company business goals must be determined jointly with product and marketing teams. This ensures savings in both time and money.

Ready to calculate?

Use A/B Test Sample Size and Power Calculator for precise, step-by-step results.

Launch Tool →