Conversion Rate Sample Size Calculator

Conversion Rate Sample Size Calculator .ab-calc-wrapper { max-width: 800px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #333; line-height: 1.6; } .ab-calc-container { background: #f9f9f9; border: 1px solid #e0e0e0; border-radius: 8px; padding: 30px; margin-bottom: 40px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); } .ab-calc-title { text-align: center; margin-bottom: 25px; color: #2c3e50; font-size: 24px; font-weight: 700; } .ab-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } @media (max-width: 600px) { .ab-form-grid { grid-template-columns: 1fr; } } .ab-input-group { margin-bottom: 15px; } .ab-label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: #555; } .ab-input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; box-sizing: border-box; transition: border-color 0.3s; } .ab-input:focus { border-color: #3498db; outline: none; } .ab-select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; box-sizing: border-box; background-color: white; } .ab-help-text { font-size: 12px; color: #7f8c8d; margin-top: 4px; } .ab-btn { width: 100%; background-color: #3498db; color: white; border: none; padding: 15px; font-size: 16px; font-weight: bold; border-radius: 4px; cursor: pointer; margin-top: 10px; transition: background-color 0.2s; } .ab-btn:hover { background-color: #2980b9; } .ab-results { margin-top: 30px; padding-top: 20px; border-top: 2px dashed #ddd; display: none; } .ab-result-box { background-color: #fff; border: 1px solid #eee; border-radius: 6px; padding: 20px; text-align: center; margin-bottom: 15px; } .ab-result-value { font-size: 32px; font-weight: 800; color: #27ae60; margin: 10px 0; } .ab-result-label { font-size: 14px; color: #7f8c8d; text-transform: uppercase; letter-spacing: 1px; } .ab-result-total { font-size: 18px; color: #555; text-align: center; margin-top: 10px; } .ab-article { margin-top: 40px; } .ab-article h2 { color: #2c3e50; margin-top: 30px; border-bottom: 2px solid #3498db; padding-bottom: 10px; display: inline-block; } .ab-article p { margin-bottom: 15px; color: #444; } .ab-article ul { margin-bottom: 20px; padding-left: 20px; } .ab-article li { margin-bottom: 10px; }
A/B Testing Sample Size Calculator
Your current conversion rate.
Relative lift you want to detect (e.g. 20% increase).
90% 95% (Standard) 99%
Confidence level to avoid false positives.
80% (Standard) 90%
Probability of finding an effect if it exists.
Sample Size Per Variation
Visitors needed for Control and Variant each
Total Visitors Required:

What is a Conversion Rate Sample Size Calculator?

Before launching an A/B test, it is crucial to know how many visitors you need to reach statistical validity. This Conversion Rate Sample Size Calculator determines the specific number of users required for each variation of your test to ensure your results are accurate and not a product of random chance.

Running a test with insufficient traffic can lead to "underpowered" tests, where you fail to detect a meaningful improvement even if one exists. Conversely, running a test too long wastes resources. This tool bridges that gap using standard statistical formulas.

Why Sample Size Matters in A/B Testing

In the world of Conversion Rate Optimization (CRO), math is just as important as design. If you stop a test too early, you might see a "false positive"—thinking a change improved conversions when it was actually just random noise. If your sample size is too small, your test lacks "power," meaning you might miss a winning variation.

Key Inputs Explained

  • Baseline Conversion Rate: This is the current performance of your control page (e.g., if 5 out of 100 people buy, your rate is 5%).
  • Minimum Detectable Effect (MDE): The smallest improvement you care about detecting. For example, if you want to detect at least a 20% increase in conversions, your MDE is 20%. Smaller MDEs require much larger sample sizes.
  • Statistical Significance (Confidence): Typically set at 95%, this means there is only a 5% chance that a winning result is a false alarm.
  • Statistical Power: Typically set at 80%, this represents the probability that your test will correctly identify a winning variation if the improvement actually exists.

How the Calculation Works

This calculator uses a standard two-tailed hypothesis test formula for proportions. It accounts for the variance in your baseline rate and the expected rate of your variation. The formula balances the risk of Type I errors (false positives) and Type II errors (false negatives).

Formula Note: As the Baseline Conversion Rate gets closer to 50%, the sample size required decreases. As the MDE gets smaller (e.g., trying to find a 1% lift vs a 50% lift), the sample size required increases exponentially.

Best Practices for Interpreting Results

Once you have your required sample size:

  1. Do not stop early: Even if one variation seems to be winning by a landslide, wait until the calculated sample size is reached to avoid "peeking" errors.
  2. Account for duration: If the calculator says you need 100,000 visitors, but you only get 1,000 per month, the test will take 100 months. You may need to increase your MDE (look for bigger wins) to make testing feasible.
  3. Full weeks only: Always run tests for full week cycles (e.g., 2 weeks, 3 weeks) to account for differences in user behavior between weekdays and weekends.
function calculateSample() { // 1. Get Input Values var baselineInput = document.getElementById("baselineRate").value; var mdeInput = document.getElementById("mde").value; var zAlpha = parseFloat(document.getElementById("significance").value); var zBeta = parseFloat(document.getElementById("power").value); // 2. Validate Inputs if (baselineInput === "" || mdeInput === "") { alert("Please fill in both the Baseline Conversion Rate and MDE."); return; } var p1 = parseFloat(baselineInput) / 100; var mde = parseFloat(mdeInput) / 100; // Validation for realistic percentages if (p1 = 1) { alert("Baseline Conversion Rate must be between 0 and 100."); return; } // 3. Logic for Calculation // p1 = baseline probability // p2 = expected probability with lift (p1 + p1*MDE) var p2 = p1 * (1 + mde); // Cap p2 at 0.999 to prevent errors, though in reality MDE shouldn't push it over 100% if (p2 > 0.999) p2 = 0.999; // Average probability (pooled) var pBar = (p1 + p2) / 2; // Standard deviation components // Part 1: related to significance (alpha) var sd1 = Math.sqrt(2 * pBar * (1 – pBar)); // Part 2: related to power (beta) var sd2 = Math.sqrt(p1 * (1 – p1) + p2 * (1 – p2)); // Calculate numerator and denominator for the sample size formula // n = [ (Z_alpha * sd1 + Z_beta * sd2)^2 ] / (p2 – p1)^2 var numerator = Math.pow((zAlpha * sd1) + (zBeta * sd2), 2); var denominator = Math.pow(Math.abs(p2 – p1), 2); // Calculate Sample Size per variation var n = numerator / denominator; // Handle edge cases (divide by zero or impossibly small differences) if (!isFinite(n) || denominator === 0) { document.getElementById("resultPerVariation").innerText = "Error"; document.getElementById("resultTotal").innerText = "Check Inputs"; document.getElementById("resultsArea").style.display = "block"; return; } // Round up to nearest whole number var samplePerVariation = Math.ceil(n); var totalSample = samplePerVariation * 2; // 4. Update Output // Format numbers with commas document.getElementById("resultPerVariation").innerText = samplePerVariation.toLocaleString(); document.getElementById("resultTotal").innerText = totalSample.toLocaleString(); // Show results div document.getElementById("resultsArea").style.display = "block"; }

Leave a Comment