Formula
n = [(Zα√(2p̄(1-p̄)) + Zβ√(p1(1-p1) + p2(1-p2)))² / (p2-p1)²]; Duration = (n × variants) / daily_visitors
The sample size formula comes from power analysis for comparing two proportions. Zα is the critical value for significance (1.96 for 95%), Zβ is for power (0.84 for 80%). p1 is baseline conversion, p2 is expected conversion with treatment (p1 × (1 + MDE)), and p̄ is the pooled proportion. The numerator captures the variance in both groups weighted by confidence requirements. The denominator is the squared effect size—smaller effects need more samples. Duration divides total required samples by daily traffic. This formula assumes two-tailed test, equal allocation, and independent observations. It works because it ensures the test has enough data to distinguish real effects from random noise with the specified confidence and power levels.
Worked Examples
Example 1: High-Traffic E-commerce
Problem:50,000 daily visitors, 4% conversion, want to detect 10% lift, 80% power, 95% significance, A/B test.
Solution:Sample size: 15,764 per variant. Duration: 1 day (but run at least 7 for day-of-week effects). Test is well-powered for quick decisions.
Result:15,764/variant | ~1 day math | 7 days minimum | Quick test
Example 2: Medium Traffic SaaS
Problem:3,000 daily visitors, 2% conversion, detect 15% lift, 80% power, 95% significance.
Solution:Sample size: 6,958 per variant. Duration: 5 days. Manageable test length. Could detect smaller effects with more time.
Result:6,958/variant | 5 days | Standard duration | Consider 10% MDE option
Example 3: Low Traffic Landing Page
Problem:500 daily visitors, 5% conversion, detect 10% lift, 80% power.
Solution:Sample size: 12,534 per variant. Duration: 50 days. Very long test. Either accept 20% MDE (13 days) or find ways to increase traffic.
Result:12,534/variant | 50 days | Too long | Increase MDE or traffic
Frequently Asked Questions
How long should an A/B test run?
A/B tests should run until they reach statistical significance (usually 95% confidence) with sufficient power (80%+). This depends on traffic, conversion rate, and minimum detectable effect. Never stop early based on preliminary results—wait for the predetermined sample size.
Why can't I stop a test when it shows significance?
Significance fluctuates during a test. Early significance is often false—with enough peeks, random variation will appear significant. Pre-commit to sample size and don't peek. Sequential testing methods exist but require different analysis approaches.
How does baseline conversion rate affect duration?
Lower conversion rates require more samples. At 1% conversion, you need many more visitors to get enough conversions for reliable statistics than at 10% conversion. Tests on low-conversion actions (purchases vs. clicks) take longer.
Should I include weekends in my test?
Yes, always run tests for complete weeks. User behavior differs by day of week. Ending mid-week biases results toward that day's patterns. Minimum one full week; preferably 2-4 weeks for stable results.
What if I don't have enough traffic?
Options: 1) Accept larger MDE (detect only big changes), 2) Test higher-funnel metrics (clicks vs. purchases), 3) Run longer tests, 4) Focus on fewer variants, 5) Consider qualitative research instead if tests are impractical.
How many variants can I test at once?
Each variant requires the same sample size. 4 variants need 4x the traffic of an A/B test. More variants also increase false positive risk without correction (Bonferroni). Start with A/B; add variants only when traffic supports it.
What's the difference between one-tailed and two-tailed tests?
Two-tailed tests detect differences in either direction (better or worse). One-tailed only detects improvement. Two-tailed is standard and safer—you want to know if a variant is significantly worse too. Sample size calculators usually assume two-tailed.
Background & Theory
Split test duration estimation applies statistical power analysis to determine how long an experiment must run to reliably detect a given effect size, enabling proper experiment planning.
## Concept Overview
Duration estimation prevents two common mistakes: stopping tests too early (false positives from noise) and running tests too long (wasted time when significance is impossible). Proper planning sets expectations and enables resource allocation.
The key insight is that sample size determines what effects you can detect. Small samples can detect large effects. Detecting small effects requires large samples. Your traffic and desired MDE determine duration.
Power analysis formalizes this relationship. Given baseline conversion rate, minimum detectable effect, desired power, and significance level, the required sample size can be calculated before the test begins.
## Key Variables & Intuition
• **Daily visitors** — Traffic available for the test
• **Baseline conversion** — Current conversion rate being tested
• **MDE** — Smallest effect worth detecting
• **Power** — Probability of detecting real effects (80-90%)
• **Significance** — Confidence level for results (95%)
• **Variants** — Number of test variations including control
## Assumptions
• Traffic is constant (or average is representative)
• Conversion rate is stable
• Visitors are independent
• No seasonal effects during test period
• Proper randomization
## Limitations & Edge Cases
• **Seasonality** — Tests spanning holidays may be confounded
• **Traffic fluctuations** — Variable traffic changes duration
• **Novelty effects** — Initial response may not persist
• **Selection bias** — Test audience may not represent population
• **Multiple metrics** — Primary metric duration may differ from secondary
**Scenario:** A test is planned for 14 days based on conversion rate. But conversion happens 7 days after first visit (delayed attribution). The 14-day test only captures conversions from the first week's visitors. Actual duration should be 21 days (14 + 7-day attribution window).
## Interpretation Guide
**Test Duration:**
- Under 7 days: Too short; day-of-week effects not captured
- 7-14 days: Quick test; ensure sufficient traffic
- 14-30 days: Standard duration; captures weekly patterns
- 30-60 days: Long test; consider business constraints
- Over 60 days: Very long; evaluate if test is practical
**Sample Size Drivers:**
- Higher baseline = fewer samples needed
- Smaller MDE = more samples needed
- Higher power = more samples needed
- More variants = more samples needed
## Practical Tips
• **Plan before starting** — Calculate duration, don't just run and hope
• **Run full weeks** — Day-of-week patterns are real; complete weeks prevent bias
• **Avoid peeking** — Multiple peeks inflate false positive rate
• **Consider practical significance** — Statistically significant ≠ worth implementing
• **Document decisions** — Record MDE, power, expected duration before launch
• **Use proper tools** — Platform calculators or statistical packages
• **Account for exclusions** — Bots, returning users affect effective sample
• **Plan for delays** — Traffic may be lower than expected
• **Commit to the plan** — Don't extend or shorten based on interim results
• **Consider opportunity cost** — Very long tests may not be worth it
## Common Mistakes
• **Stopping early** — Declaring winners before reaching sample size
• **Ignoring power** — Underpowered tests miss real effects
• **Too small MDE** — Wanting to detect tiny effects leads to impractical durations
• **Forgetting variants** — Each variant needs full sample size
• **Ignoring seasonality** — Testing through Black Friday skews results
• **No baseline measurement** — Inaccurate baseline leads to wrong duration estimate
• **Peeking at results** — Inflates false positive rate
• **Stopping for business reasons** — If you stop early, treat results as directional only
## When NOT to Use
• **Qualitative decisions** — Some changes don't need statistical validation
• **Obvious improvements** — Fixing a broken button doesn't need a test
• **Very low traffic** — Tests may be impractical; use other methods
• **Rapid iteration** — Sometimes shipping fast and monitoring is better
History
A/B test duration estimation evolved from basic significance testing through sample size planning to sophisticated experiment design frameworks that balance statistical rigor with business velocity.
## Origins & Why It Emerged
Statistical hypothesis testing dates to the early 20th century (Fisher, Neyman, Pearson). But applying statistics to online experiments became practical only with web analytics in the 2000s.
Early web testing was often underpowered—teams ran tests too short, declared winners based on noise, and made changes that didn't actually improve metrics. The replication crisis in academia highlighted similar problems.
Sample size planning emerged as a discipline. Rather than stopping when significance appeared, teams learned to calculate required samples beforehand and commit to running until that threshold.
## Evolution in Practice
Simple calculators enabled basic sample size calculation. Given baseline rate, desired MDE, power, and significance, anyone could determine required samples. This was a major improvement over ad hoc testing.
Sequential testing methods (Bayesian approaches, group sequential designs) offered alternatives to fixed-sample tests. These allow valid early stopping but require different statistical frameworks and careful implementation.
Platform sophistication increased. Optimizely, VWO, and Google Optimize built statistics into their products. Automated duration recommendations made proper testing accessible to non-statisticians.
## Modern Usage Today
Modern experimentation platforms automate duration calculation and prevent premature stopping. They integrate with traffic forecasting to estimate test completion dates and alert when tests are underpowered.
Multi-armed bandit approaches offer alternatives to classical A/B testing, optimizing during the experiment rather than just evaluating at the end. These require different duration considerations.
Meta-analysis of multiple experiments, pre-registration of experiment plans, and holdout groups for validation have become standard at sophisticated organizations.
## Common Misconceptions
• **Bigger sample is always better** — Diminishing returns after sufficient power; opportunity cost of long tests
• **Significance means the effect is real** — It means unlikely due to chance; could still be noise
• **I can stop when significant** — Only if using sequential methods designed for early stopping
• **More variants = more learning** — Also means longer tests and multiple comparison problems
• **One week is enough** — Depends on traffic, conversion rate, and MDE; rarely is one week sufficient for low-traffic sites