A/B Testing
What is A/B Testing?
A/B testing is an experiment method that randomly splits users between a control and a variant and compares them on one chosen metric. Random assignment lets a team attribute a measurable difference to the change itself.
Updated November 2026 · 4 min read
A/B testing is a controlled experiment that shows two versions of something, such as a page, feature or message, to randomly assigned groups of users and measures which version performs better on a chosen metric. Version A is usually the current experience (the control) and version B is the change (the variant). Because users are assigned at random, a meaningful difference in outcomes can be attributed to the change rather than to who happened to see it.
A/B tests let product teams replace opinion with evidence for decisions that can be measured. They are most useful when a product has enough traffic to detect realistic differences and when the question is "which of these works better" rather than "what should we build."
Origins of a/B testing
The method rests on the randomized controlled experiment, whose statistical foundations were laid by Ronald Fisher in the 1920s and 1930s, including his book The Design of Experiments (1935). Direct-mail marketers ran split tests for decades before the web. Online, large technology companies made continuous experimentation routine, and today experimentation platforms and feature flags make it practical for much smaller teams.
Components of an a/B test
- Hypothesis. A specific prediction: "Shortening the signup form from six fields to three will increase completed signups, because users abandon at the company-size field."
- Primary metric. One metric chosen in advance that decides the test, such as conversion rate.
- Guardrail metrics. Metrics that must not get worse, such as refund rate, page load time or support contacts.
- Randomization unit. Usually the user or account, so the same person always sees the same version.
- Sample size and duration. Calculated before the test from the baseline rate and the smallest effect worth detecting.
- Significance threshold. Commonly a 5% false-positive rate (p < 0.05) with 80% statistical power.
How to run an a/B test
- Start from a problem. Use research or analytics to find where users struggle, then write the hypothesis.
- Choose metrics. Pick one primary metric and a few guardrails before building anything.
- Estimate sample size. A rough rule for 80% power at a 5% significance level is n ≈ 16 × p × (1 − p) ÷ d² per group, where p is the baseline rate and d is the absolute difference you want to detect. Online calculators give more precise numbers.
- Build and check the variant. Confirm both versions log events correctly and that traffic splits as planned.
- Run for the planned duration. Cover at least one full weekly cycle so weekday and weekend behavior are both included.
- Analyze once. Compare results at the planned end, check guardrails and look at major segments for problems, not for new winners.
- Decide and record. Ship, iterate or discard, and write down what was learned.
A/B testing example
Consider a hypothetical SaaS company whose pricing page converts 4.0% of visitors to trial signups. The team wants to detect an increase to 4.8%, a 0.8-point absolute difference. Using the rule of thumb, 16 × 0.04 × 0.96 ÷ 0.008² = 9,600 visitors per group, so the team plans for 10,000 per group.
At the end of the test, the control has 400 signups from 10,000 visitors (4.0%) and the variant has 480 from 10,000 (4.8%). The relative lift is 0.8 ÷ 4.0 = 20%. A two-proportion z-test gives z ≈ 2.76 and a two-sided p-value of about 0.006, well below 0.05. Refund requests and support tickets, the guardrails, show no change, so the team ships the variant.
A/B testing vs. multivariate testing
| Aspect | A/B testing | Multivariate testing |
|---|---|---|
| What changes | One version against another | Several elements at once, in combinations |
| Traffic needed | Lower | Much higher, since traffic is split across many combinations |
| What it tells you | Which version wins overall | Which elements, and which combinations, drive the result |
| Best for | Most product and marketing decisions | High-traffic pages with several independent elements |
An A/B/n test compares more than two versions against one control. It needs more traffic than a simple A/B test for the same sensitivity. See multivariate testing for details.
Common pitfalls
- Peeking and stopping early. Checking results daily and stopping at the first significant reading inflates false positives. Fix the sample size in advance or use a sequential testing method designed for repeated looks.
- Underpowered tests. With too little traffic, real improvements look like noise. Calculate sample size first; if it is unachievable, test a bolder change or use qualitative methods.
- Too many metrics. Checking twenty metrics makes it likely one will look significant by chance. Commit to a primary metric.
- Novelty effects. Users sometimes engage with anything new. Longer tests or holdout groups show whether the effect lasts.
- Mismatched groups. If the traffic split is noticeably different from what was planned, for example 52/48 instead of 50/50 on a large sample, something is wrong with assignment or logging. Investigate before trusting results.
A/B testing is one tool within a broader product experimentation framework. It works best alongside conversion rate optimization programs and the practice of rapid experimentation, with qualitative research explaining why a variant won.
Frequently asked questions
How do you calculate the sample size for an A/B test?
A rough rule for 80% power at a 5% significance level is n ≈ 16 × p × (1 − p) ÷ d² per group, where p is the baseline rate and d is the absolute difference to detect. With a 4.0% baseline and a 0.8-point target lift, that comes to about 9,600 visitors per group. Online calculators give more precise numbers.
How long should an A/B test run?
An A/B test should run until it reaches the sample size calculated before launch, and for at least one full weekly cycle so weekday and weekend behavior are both included. Stopping at the first significant reading inflates false positives. If the team must check repeatedly, use a sequential testing method designed for it. Longer runs also show whether novelty effects fade.
What is the difference between A/B testing and multivariate testing?
An A/B test compares one version against another and shows which wins overall, with lower traffic needs. Multivariate testing changes several elements at once in combinations, showing which elements and combinations drive the result, but needs much more traffic because visitors are spread across many combinations. It suits high-traffic pages with several independent elements, while A/B tests fit most decisions.
What are guardrail metrics in an A/B test?
Guardrail metrics are measures that must not get worse while an A/B test chases its primary metric. Examples include refund rate, page load time and support contacts. A variant that lifts conversion but raises refunds may not be worth shipping. Teams pick guardrails before the test starts, alongside the single primary metric that decides which version wins.
Related terms
Conversion Rate
The share of eligible people who complete a target action.
Multivariate Testing
Testing combinations of several page elements at the same time.
Product Experimentation Framework
A shared process for running trustworthy product experiments.
Conversion Rate Optimization (CRO)
Using research and tests to raise the share who convert.