notAcalculator logo

A/B Testing & Experimentation: How to Run Tests That Actually Teach You Something

How to run A/B tests that actually teach you something: hypothesis testing, p-values, confidence intervals, statistical power, and the traps that fool even experienced teams.

The Tasting Illusion

In the 1970s, Pepsi ran a marketing campaign that seemed to prove something remarkable: in blind taste tests, more people preferred Pepsi over Coke. The campaign was a sensation — millions of consumers sipped from unmarked cups and pointed to the sweeter drink. Pepsi's stock rose. Coke panicked, reformulated, and launched "New Coke" in 1985, one of the most infamous product launches in history[pepsi-challenge].

The problem wasn't the taste. It was the test. A single sip from a small cup measures immediate sweetness preference, not which beverage someone drinks for decades. The blind test had statistical significance — the difference was real and repeatable — but it lacked practical significance. It measured the wrong thing.

This is the central trap of A/B testing and experimentation: statistical significance does not mean business significance. A test can prove, with 99% confidence, that a button color change increases clicks by 0.3% — a finding that is simultaneously true and useless. This guide explains how to design and interpret experiments that avoid that trap: how to set up hypotheses, calculate whether your sample is large enough, interpret p-values without fooling yourself, and distinguish signals that matter from noise that merely looks convincing.

The Logic of Experimentation

Every controlled experiment follows the same skeleton, whether you're testing a new cancer drug, a website headline, or a pricing page. You start with a hypothesis — a specific, testable prediction. You split your subjects randomly into two groups: the control (which sees the current version) and the treatment (which sees the change). You measure an outcome in both groups. Then you ask a single question: is the difference I see larger than what random chance would typically produce?

That last step is where statistics enters. The logic is counterintuitive on purpose: you begin by assuming the boring explanation (your change did nothing) and then check whether the data is incompatible with that assumption. This starting assumption is called the null hypothesis, written H0H_0. The alternative — your actual prediction — is the alternative hypothesis, written H1H_1.

The engine that drives the answer is the p-value: the probability of observing a difference at least as large as the one you measured, assuming the null hypothesis is true[nixofon-pvalue].

p=P(observed differenceH0 is true)p = P(\text{observed difference} \mid H_0 \text{ is true})
[nixofon-pvalue]

A p-value of 0.03 means: if your change actually did nothing, you would still see a difference this large 3% of the time by pure chance. It does NOT mean there is a 97% chance your change works. This misinterpretation is so common that the American Statistical Association published a formal statement warning against it[nixofon-pvalue].

The Two Mistakes You Can Make

Whenever you draw conclusions from an experiment, you can go wrong in two distinct ways[georgiev-ab-testing]:

Type I (false positive)You conclude the change works when it doesn'tp-value (α)Ship a dud, waste engineering time
Type II (false negative)You conclude the change does nothing when it actually worksβMiss a real improvement

The p-value threshold you choose — the significance level, denoted α — is the Type I error rate you're willing to tolerate. The conventional 0.05 means "I accept a 5% chance of shipping something that does nothing." In high-stakes domains (medicine, aviation), researchers demand α = 0.001 or lower. In fast-moving consumer apps, teams sometimes accept 0.10 to move faster[kohavi-trustworthy].

The Type II error rate, β, is the flip side. If β = 0.20, you have a 20% chance of missing a real effect. The complement, 1 − β, is called statistical power: the probability that your test will detect an effect if one truly exists[cohen-power]. A test with 80% power and 5% significance is the standard minimum in most fields — and many published studies fall short of even that[cohen-power].

Power is the probability you will detect a real effect. Most teams ignore it — and run tests that were doomed to be inconclusive before the first user arrived.

Sample Size: The Number That Decides Everything

Here is the uncomfortable truth about A/B testing: a test with too few users cannot detect anything useful, no matter how good the change is. If you run a test on 50 users and see no significant result, you have learned nothing — the test may simply have been too small to detect the effect. This is an underpowered test, and underpowered tests produce more noise than signal.

The required sample size depends on four numbers:

  1. Baseline conversion rate (e.g., 5% of visitors sign up)
  2. Minimum detectable effect (e.g., you want to catch a 10% relative lift → from 5% to 5.5%)
  3. Significance level α (typically 0.05)
  4. Power 1 − β (typically 0.80)

The formula for a two-proportion z-test (the standard for conversion rate comparisons) is approximately[georgiev-ab-testing]:

n(zα/2+zβ)22p(1p)(p1p2)2n \approx \frac{(z_{\alpha/2} + z_\beta)^2 \cdot 2p(1-p)}{(p_1 - p_2)^2}
[georgiev-ab-testing]

where p is the pooled proportion, p1p2p_1 - p_2 is the absolute effect size, and zα/2z_{\alpha/2}, zβz_\beta are the critical z-values (1.96 and 0.84 for α=0.05, power=0.80).

For a baseline of 5% and a minimum detectable effect of 10% relative (0.5 percentage points absolute), this gives n ≈ 15,700 users per variation. For a 5% relative lift — a more realistic goal — you need roughly 10× more: ~157,000 users per variation. This is why small teams with modest traffic often conclude that A/B testing "doesn't work" — they were running experiments that needed ten times their monthly traffic to detect anything. The Sample Size Calculator computes this directly for your baseline and desired power, so you can plan your test duration before launching.

Users per variation needed for 80% power, α=0.05, two-sided test. Smaller effects and lower baselines explode the sample size.

Practical rule of thumb: If your site gets 1,000 visitors per day and you need 15,700 per variation, the test runs for ~31 days. If your test takes longer than 4 weeks, reconsider whether the minimum detectable effect is realistic — or whether A/B testing is the right tool for your traffic level.

Confidence Intervals: The Number That Tells the Whole Story

A p-value tells you whether the effect is "significant." A confidence interval tells you the range of plausible effect sizes — which is usually what you actually want to know[nist-ehandbook].

A 95% confidence interval of [+0.2%, +1.8%] for a conversion rate lift means: we are 95% confident the true effect lies between 0.2 and 1.8 percentage points. Crucially, this interval does NOT include zero — which is why the p-value is below 0.05. But it also tells you something the p-value hides: the effect could be as small as 0.2%, which may not justify the engineering cost.

The formula for a confidence interval on the difference between two proportions:

(p1p2)±zα/2p1(1p1)n1+p2(1p2)n2(p_1 - p_2) \pm z_{\alpha/2} \sqrt{\frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2}}
[nist-ehandbook]

When the confidence interval includes zero, the result is not statistically significant. When it does not include zero, you have a significant result — and the interval's width tells you how precisely you've estimated the effect. A wide interval ([−0.1%, +2.1%]) means "something is happening, but we're not sure exactly what." A narrow interval [+0.8%, +1.2%] means "the effect is almost certainly in this tight range"[georgiev-ab-testing]. If you have the observed counts from a finished test, the Confidence Interval Calculator returns the interval directly — useful for reporting results to stakeholders who want to know the range, not just the p-value.

Use the confidence interval as your primary result, not the p-value. It answers the business question ("how much lift can I expect?") rather than the statistical one ("can I reject the null?").

Chi-Square and t-Tests: Choosing the Right Tool

Not all experiments compare conversion rates. Sometimes you're comparing averages (revenue per user, time on page, order value), and sometimes you're comparing distributions across categories (did the change shift users between plan tiers?). The right test depends on the data type.

For conversion rates and proportions (click/no click, signup/no signup): use a chi-square test or a two-proportion z-test. The chi-square test checks whether the observed frequencies in your 2×2 table (control vs treatment × converted vs not) differ from what the null hypothesis predicts[nist-ehandbook].

χ2=(OiEi)2Ei\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}

where OiO_i is the observed count and EiE_i is the expected count under the null. The result is compared to a chi-square distribution with 1 degree of freedom to obtain a p-value. The Chi-Square Calculator does this computation from your observed counts, returning both the statistic and the p-value — useful when you have the raw numbers from a finished test and want to verify significance without building the table by hand.

For continuous outcomes (revenue, time, score): use a t-test. The t-test compares the means of two groups while accounting for the spread (standard deviation) within each groups[nist-ehandbook]:

t=xˉ1xˉ2s12n1+s22n2t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}

where xˉ\bar{x} is the sample mean, ss is the standard deviation, and nn is the sample size. The denominator is the standard error of the difference — a quantity that combines the uncertainty from both groups[nist-ehandbook]. The t-Test Calculator computes this from your two samples, handling both the equal-variance and unequal-variance (Welch's) cases.

The standard deviation matters enormously here. If revenue per user swings wildly (high variance), you need far more users to detect the same mean difference than if revenue is consistent. This is why the confidence interval on the mean difference is so useful: it shows whether the signal (the mean difference) is large relative to the noise (the standard deviation)[nist-ehandbook].

Practical decision rule:

  • Binary outcome (clicked/didn't, signed up/didn't) → chi-square or z-test for proportions
  • Continuous outcome (revenue, time, score) → t-test
  • Comparing more than two variants → ANOVA (not covered here)

The Traps That Fool Experienced Teams

Peeking at Results

The p-value formula assumes you look at the data exactly once, at a predetermined sample size. If you peek at your test on day 3, day 7, day 10 — and stop as soon as p < 0.05 — you are dramatically inflating your false positive rate. With 5 peeks, the true false positive rate is not 5% but roughly 14%[georgiev-ab-testing].

Fix: Decide your sample size in advance, run the test to that sample size, then analyze once. If you must peek, use sequential testing methods (always-valid p-values, alpha spending) that adjust the threshold for each peek — but these require roughly 30% more users for the same power.

P-Hacking (Multiple Comparisons)

If you test 20 different metrics (conversion rate, revenue, time on page, scroll depth, bounce rate...) and report the one that came back significant at p < 0.05, you are p-hacking. With 20 independent tests at α = 0.05, the probability of at least one false positive is 1 − (1−0.05)^20 ≈ 64%[nixofon-pvalue].

Fix: Pre-specify a single primary metric before the test begins. Treat everything else as exploratory. If you must test multiple metrics, apply a Bonferroni correction: divide α by the number of tests (so 0.05 / 20 = 0.0025 for 20 metrics).

Simpson's Paradox

A treatment can win in every subgroup (mobile users, desktop users, new visitors, returning visitors) and lose in aggregate — or vice versa. This happens when the subgroups have very different sizes and very different baseline rates.

Fix: Always segment your results. If the treatment effect reverses between mobile and desktop, the aggregate number is misleading. Report the per-segment results alongside the overall.

Novelty and Primacy Effects

A new feature may initially perform worse (users are confused) or better (users are curious) than it will long-term. A 2-week test captures the novelty effect, not the steady-state effect.

Fix: Run tests for at least 2 full weeks (to capture day-of-week effects) and ideally 4 weeks for features with learning curves. Be skeptical of results that appear in week 1 and vanish in week 2.

A Worked Example: Button Color

A team tests whether a green signup button outperforms the current blue one. Baseline conversion rate: 4.0%. They want to detect a 10% relative lift (to 4.4%) with 80% power and α = 0.05.

Step 1 — sample size. Using the formula above with p₁ = 0.04, p₂ = 0.044, α = 0.05, power = 0.80: n ≈ 39,000 users per variation. With 20,000 daily visitors split 50/50, the test runs for ~4 days.

Step 2 — run the test. Control (blue): 780 conversions out of 39,000 (2.00%). Treatment (green): 936 conversions out of 39,000 (2.40%).

Step 3 — chi-square test. The observed counts form a 2×2 table. The chi-square statistic is 15.2, which gives p ≈ 0.0001 — well below 0.05. The result is statistically significant.

Step 4 — confidence interval. The difference is 0.40 percentage points, with a 95% CI of [+0.22%, +0.58%]. This interval excludes zero (confirming significance) and tells the business: "the lift is somewhere between 0.22 and 0.58 percentage points, or 5.5% to 14.5% relative."

Step 5 — decision. Is a 0.4 percentage point lift worth the engineering cost and the design inconsistency? That is a business question, not a statistical one. The statistics only say: the lift is real and almost certainly between 0.22% and 0.58%.

When A/B Testing Is the Wrong Tool

A/B testing is powerful, but it is not always the right method. Consider alternatives when:

  • Your traffic is too low. If you need 100,000 users per variation and get 5,000 per month, a properly powered test would take years. Use qualitative research, user interviews, or heuristic evaluation instead.
  • You're testing a fundamental redesign. A/B testing measures incremental changes. A complete redesign has too many variables changing at once to attribute causality. Use before/after analysis with caution.
  • Network effects exist. If users in the treatment group interact with users in the control group (social networks, marketplaces), the groups are no longer independent. The test is invalid.
  • You need to understand WHY. A/B testing tells you whether something works, not why. Pair experiments with qualitative research (session recordings, user interviews) to understand the mechanism.

Practical Tips for Running Experiments

  1. Pre-register your test. Write down the hypothesis, primary metric, sample size, and analysis plan before collecting data. This prevents post-hoc rationalization.
  2. Run an A/A test occasionally. Show both groups the same experience. If you get a "significant" result, your testing infrastructure is broken.
  3. Segment after, not during. Pre-specify one primary metric. Segment (by device, by region, by new/returning) only as exploratory analysis.
  4. Track guardrail metrics. A treatment might increase clicks but hurt revenue. Define guardrail metrics (revenue per user, unsubscribe rate, page load time) that must not degrade.
  5. Account for multiple variants. If you run an A/B/C/D test, apply a Bonferroni correction (α / number of comparisons) or use a false discovery rate method.
  6. Report confidence intervals, not just p-values. "Lift of 0.4 pp, 95% CI [+0.22, +0.58]" is more actionable than "p = 0.0001."

Limitations and Edge Cases

A/B testing has honest limitations. It is not good at detecting small effects unless you have enormous traffic. It assumes random assignment — if your randomization is broken (e.g., more mobile users end up in treatment by chance), the results are biased. It measures short-term effects — a headline that clicks well today may fatigue users after a month. And it cannot detect interactions unless you specifically design for them (a treatment may help new users but hurt returning users, which cancels out in aggregate).

Finally, A/B testing is a tool for optimization, not for strategy. It can tell you which of two headlines works better, but it cannot tell you what your content strategy should be. Use it to refine, not to think.

Frequently Asked Questions

What is a p-value?
The probability of observing a result at least as extreme as yours, assuming the null hypothesis (that your change did nothing) is true. A p-value of 0.05 means: if your change did nothing, you would still see a result this large 5% of the time by chance. It is NOT the probability that your change works.
What is the difference between statistical significance and practical significance?
Statistical significance means the observed difference is unlikely due to chance (low p-value). Practical significance means the difference is large enough to matter for your business. A result can be statistically significant (real) but practically insignificant (too small to care about).
How many users do I need for an A/B test?
It depends on your baseline rate and the minimum effect you want to detect. For a 5% baseline and a 10% relative lift (to 5.5%), you need roughly 15,700 users per variation for 80% power at α=0.05. Smaller effects require dramatically more users.
What is statistical power?
The probability that your test will detect a real effect if one exists. Typically set to 80% (β=0.20). An underpowered test — one with too few users — will often conclude 'no significant difference' even when a real effect exists.
Why shouldn't I peek at my test results every day?
Because each peek inflates your false positive rate. With 5 peeks at α=0.05, your true false positive rate is roughly 14%. Decide your sample size in advance and analyze once, or use sequential testing methods that adjust for peeking.
What is the difference between a t-test and a chi-square test?
Use a t-test when comparing means of continuous outcomes (revenue, time, score). Use a chi-square test when comparing proportions or frequencies (conversion rates, click/no-click). The t-test assumes continuous data; the chi-square test works with counts in categories.
What is a confidence interval?
A range of plausible values for the true effect. A 95% confidence interval of [+0.2%, +1.8%] means we are 95% confident the true lift is between 0.2 and 1.8 percentage points. If the interval excludes zero, the result is statistically significant.
What is Simpson's Paradox?
A phenomenon where a trend appears in every subgroup but reverses in aggregate (or vice versa). It happens when subgroups have very different sizes and baselines. Always segment your results — the aggregate can hide or reverse real effects.

References

  1. [1]Kohavi, Ron, Roger Longbotham, and Dan Sommerfield. "Controlled Experiments on the Web: Survey and Practical Guide." Data Mining and Knowledge Discovery, vol. 18, 2009, pp. 140–181.
  2. [2]Georgiev, Georgi. "Statistical Methods in Online A/B Testing." 2022.
  3. [3]Nuzzo, Regina. "Statistical Errors." Nature, vol. 506, 2014, pp. 150–152.
  4. [4]Kahneman, Daniel. Thinking, Fast and Slow. Farrar, Straus and Giroux, 2011.Buy on Amazon
  5. [5]Pepsi Challenge. (n.d.). In Wikipedia. Retrieved from https://en.wikipedia.org/wiki/Pepsi_Challenge
  6. [6]NIST/SEMATECH. (2026). e-Handbook of Statistical Methods.
  7. [7]Cohen, Jacob. Statistical Power Analysis for the Behavioral Sciences. 2nd ed., Lawrence Erlbaum, 1988.Buy on Amazon
Give us your feedback! Was this useful?
1b

UnByte — Independent Software Engineering

All reference data cites its sources — Editorial policy