{
  "slug": "ab-test-sample-size-calculator",
  "title": "A/B Test Sample Size Calculator",
  "heading": "A/B Test Sample Size Calculator",
  "category": "math",
  "url": "https://www.revenuelab.fyi/toolbox/ab-test-sample-size-calculator",
  "summary": "How many visitors per variant you need before you look at results.",
  "description": "Deciding sample size before a test starts is what keeps you from peeking at noisy early data and calling a winner too soon. This calculator uses the standard two-proportion power formula: it takes your baseline conversion rate, the minimum lift worth detecting, your desired confidence level, and statistical power, then returns the visitors per variant and total runtime given your daily traffic. Smaller minimum detectable effects require dramatically more traffic — halving the effect you want to detect roughly quadruples the sample size, because the formula scales with the inverse square of the effect size. Most teams underestimate this and shut tests down at week two when they never had enough traffic to detect a 5% relative lift in the first place. Run the numbers up front, pick a minimum detectable effect you can actually afford to wait for, and commit to the full sample size before evaluating significance. If your traffic can't support detecting a lift that matters to the business within a reasonable window, the test isn't worth running as designed — widen the effect size, combine variants, or use a sequential testing method instead.",
  "formula": "n per group = (Zα/2 + Zβ)² × [p1(1−p1) + p2(1−p2)] ÷ (p2 − p1)², where p2 = p1 × (1 + MDE).",
  "dateModified": "2026-09-30",
  "run_url": "https://www.revenuelab.fyi/api/public/calc?tool=ab-test-sample-size-calculator",
  "inputs": [
    {
      "id": "baseline",
      "label": "Baseline conversion rate",
      "kind": "number",
      "hint": null,
      "default": 5,
      "unit": "%",
      "min": 0.1,
      "max": 90
    },
    {
      "id": "mde",
      "label": "Minimum detectable relative lift",
      "kind": "number",
      "hint": null,
      "default": 10,
      "unit": "%",
      "min": 1,
      "max": 200
    },
    {
      "id": "confidence",
      "label": "Confidence level",
      "kind": "select",
      "hint": null,
      "default": "95",
      "options": [
        {
          "value": "90",
          "label": "90%"
        },
        {
          "value": "95",
          "label": "95%"
        },
        {
          "value": "99",
          "label": "99%"
        }
      ]
    },
    {
      "id": "power",
      "label": "Statistical power",
      "kind": "select",
      "hint": null,
      "default": "80",
      "options": [
        {
          "value": "80",
          "label": "80%"
        },
        {
          "value": "90",
          "label": "90%"
        }
      ]
    },
    {
      "id": "variants",
      "label": "Number of variants (incl. control)",
      "kind": "number",
      "hint": null,
      "default": 2,
      "unit": null,
      "min": 2,
      "max": 6
    },
    {
      "id": "dailyTraffic",
      "label": "Total daily traffic to the test",
      "kind": "number",
      "hint": null,
      "default": 4000,
      "unit": null,
      "min": 1,
      "max": null
    }
  ],
  "outputs": [
    {
      "id": "nPerGroup",
      "label": "Visitors needed per variant",
      "format": "number",
      "hint": null,
      "primary": true
    },
    {
      "id": "total",
      "label": "Total visitors across variants",
      "format": "number",
      "hint": null,
      "primary": false
    },
    {
      "id": "days",
      "label": "Days to reach sample size",
      "format": "number",
      "hint": null,
      "primary": false
    },
    {
      "id": "weeks",
      "label": "Weeks to reach sample size",
      "format": "decimal",
      "hint": null,
      "primary": false
    },
    {
      "id": "p2pct",
      "label": "Target variant conversion rate",
      "format": "percent",
      "hint": null,
      "primary": false
    }
  ],
  "worked_example": {
    "inputs": [
      "Baseline conversion rate: 5 %",
      "Minimum detectable relative lift: 10 %",
      "Confidence level: 95%",
      "Statistical power: 80%",
      "Number of variants (incl. control): 2",
      "Total daily traffic to the test: 4000"
    ],
    "outputs": [
      "Visitors needed per variant: 31,232",
      "Total visitors across variants: 62,464",
      "Days to reach sample size: 16",
      "Weeks to reach sample size: 2.2",
      "Target variant conversion rate: 5.50%"
    ]
  },
  "how_to": {
    "title": "How to use this",
    "steps": [
      "Enter baseline conversion rate (%).",
      "Enter minimum detectable relative lift (%).",
      "Enter confidence level.",
      "Enter statistical power.",
      "Enter number of variants (incl. control).",
      "Enter total daily traffic to the test.",
      "Read your visitors needed per variant on the right — it updates as you type.",
      "Hit Share to keep the scenario or send it to someone."
    ]
  },
  "scenarios": [
    {
      "name": "Conservative",
      "description": "Lower-end numbers — what if things land soft?",
      "values": {
        "baseline": 3,
        "mde": 6,
        "confidence": "95",
        "power": "80",
        "variants": 2,
        "dailyTraffic": 2400
      }
    },
    {
      "name": "Typical",
      "description": "Defaults — the most common real-world setup.",
      "values": {
        "baseline": 5,
        "mde": 10,
        "confidence": "95",
        "power": "80",
        "variants": 2,
        "dailyTraffic": 4000
      }
    },
    {
      "name": "Ambitious",
      "description": "Higher-end numbers — what if things really pop?",
      "values": {
        "baseline": 8,
        "mde": 16,
        "confidence": "95",
        "power": "80",
        "variants": 3,
        "dailyTraffic": 6400
      }
    }
  ],
  "limitations": [
    "Results are rounded for display; the underlying calculation keeps full precision.",
    "Very large or very small inputs may hit floating-point limits in the browser.",
    "Inputs outside the accepted range are clamped rather than rejected."
  ],
  "faq": [
    {
      "q": "Why does a smaller minimum detectable effect need so much more traffic?",
      "a": "The sample size formula divides by the squared difference between the two rates. Cutting the detectable lift in half means that denominator shrinks by 4x, so the required sample roughly quadruples. This is why testing tiny copy tweaks on low-traffic pages rarely reaches significance in any reasonable timeframe."
    },
    {
      "q": "Should I use 80% or 90% power?",
      "a": "80% power is the common default and means you'll correctly detect a true effect 4 out of 5 times. Use 90% for high-stakes changes like pricing or checkout flow where missing a real effect is costly — it costs you roughly 30% more sample size."
    },
    {
      "q": "What if I'm testing more than two variants?",
      "a": "Each additional variant needs its own full sample versus control, and running multiple comparisons inflates your false positive rate. Either raise your confidence threshold (Bonferroni-style correction) or limit tests to 2-3 variants at a time."
    },
    {
      "q": "Can I stop early if results look significant?",
      "a": "Not without a pre-planned sequential testing method. Checking p-values daily and stopping the moment you cross 0.05 inflates your false positive rate far above 5%, sometimes to 20-30%, because you're giving noise many chances to look significant."
    }
  ],
  "related": [
    "https://www.revenuelab.fyi/toolbox/landing-page-conversion-lift-value",
    "https://www.revenuelab.fyi/toolbox/brand-lift-survey-sample-size"
  ],
  "license": "CC-BY-4.0",
  "citation": "RevenueLab — A/B Test Sample Size Calculator (https://www.revenuelab.fyi/toolbox/ab-test-sample-size-calculator)"
}