Prompt

sample size calculator for A/B tests

Technology / AB Testing & Experimentation1 observationLast seen Oct 13, 2026

Latest observation

Oct 13, 2026OpenAI APIWeb search: off

Here’s a practical sample size calculator for A/B tests you can use.

1) What you need

To calculate sample size, you typically need:

  • Baseline conversion rate (p1): current conversion rate for variant A
  • Minimum detectable effect (MDE): the smallest lift you want to detect
  • Significance level (alpha): usually 0.05
  • Power: usually 0.8 or 0.9
  • Test type: usually two-sided

2) Formula for two-proportion A/B test

For conversion-rate tests, the approximate sample size per group is:

[ n = \frac{\left(z_{1-\alpha/2}\sqrt{2\bar{p}(1-\bar{p})} + z_{1-\beta}\sqrt{p_1(1-p_1)+p_2(1-p_2)}\right)^2}{(p_2-p_1)^2} ]

Where:

  • (p_1) = baseline conversion rate
  • (p_2 = p_1 + \text{MDE})
  • (\bar{p} = (p_1 + p_2)/2)
  • (z_{1-\alpha/2}) = z-value for alpha
  • (z_{1-\beta}) = z-value for power

3) Quick example

Suppose:

  • Baseline conversion rate = 10%
  • MDE = 2 percentage points (10% to 12%)
  • Alpha = 0.05
  • Power = 0.80

Then you’ll need roughly:

  • ~3,800 users per group
  • ~7,600 total users

4) Simple Python calculator

import math
from scipy.stats import norm

def ab_sample_size(p1, mde, alpha=0.05, power=0.8, two_sided=True):
    p2 = p1 + mde
    if p2 <= 0 or p2 >= 1:
        raise ValueError("p2 must be between 0 and 1")

    z_alpha = norm.ppf(1 - alpha/2) if two_sided else norm.ppf(1 - alpha)
    z_beta = norm.ppf(power)

    p_bar = (p1 + p2) / 2

    numerator = (
        z_alpha * math.sqrt(2 * p_bar * (1 - p_bar)) +
        z_beta * math.sqrt(p1 * (1 - p1) + p2 * (1 - p2))
    ) ** 2

    denominator = (p2 - p1) ** 2

    return math.ceil(numerator / denominator)

# Example:
n = ab_sample_size(p1=0.10, mde=0.02, alpha=0.05, power=0.8)
print("Sample size per group:", n)
print("Total sample size:", 2 * n)

5) If you want a ready-to-use rule of thumb

For conversion tests:

  • Low baseline rate (1–5%) → often need large samples
  • Moderate baseline rate (5–20%) → thousands per group is common
  • Smaller MDE → sample size rises quickly
  • Higher power → more sample needed

6) Excel / Google Sheets formula

If you want, I can give you an Excel-friendly formula too.


If you want, I can also provide:

  1. a Google Sheets / Excel template,
  2. a calculator for continuous metrics (e.g. revenue, time on site), or
  3. a web form / JavaScript version.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.