Skip to content

Product

A/B Testing (Comparing Two Variants)

The idea, in plain English

An A/B test is a fair race between two versions of something to see which one wins. You show version A to one random half of your users and version B to the other half, then compare how each did. It's like a taste test with two recipes: same crowd, split evenly, and you count how many people liked each. Because the split is random, any difference in the result is probably caused by the change itself, not by luck about who saw what.

How it works

  1. 1Split users randomly into two groups so the only real difference is which version they see.
  2. 2Show group A the original and group B the change, and count a success for each — a signup, a purchase, a click.
  3. 3Turn each group's successes into a conversion rate: successes divided by visitors.
  4. 4Compare the rates. The higher one wins; the 'lift' is how much better the winner did, relative to the other.

When you'd use it

Use an A/B test when you can send real traffic to two versions and you have enough visitors for the result to mean something. It's the standard way to settle 'which button color / headline / flow converts better' with evidence instead of opinion.

Common beginner mistakes

  • Calling a winner too early on tiny numbers. With only a handful of visitors, random noise can look like a real difference — wait for enough data.
  • Changing several things at once between A and B. If the versions differ in three ways, a win tells you nothing about WHICH change caused it.

Try it — edit and run

Click the code to edit · press ⌘/Ctrl+↵ to run

Editable code. Tab and Shift+Tab indent. Press Escape, then Tab, to move focus out of the editor.

Expected output — hit Run to try it
Variant A: 5.0% conversion
Variant B: 6.5% conversion
Winner: B
Relative lift: 30.0%

Not sure this is the right topic? See the learning paths → or where this leads →