Please enable JavaScript to use CodeHS

Product Management & Decisions

Experimenting with A/B tests

You think a green "Buy" button might sell more than a blue one. Instead of guessing, you can run an A/B test: show the old version to one group, the new version to another group, and measure what happens.

Experiments ~10 min High School / College Prep
The Big Idea

What is an A/B test?

Suppose you run a school club website and you want more people to sign up for the mailing list. You wonder whether a bigger headline or a shorter form would help. An A/B test lets you compare two versions side by side.

Version A is usually the existing design — the control. Version B is the new idea — the variant. Visitors are randomly split between the two. After enough visitors, you compare the metric you care about, such as sign-up rate or purchase rate.

A/B testing is powerful because it moves decisions from opinion to evidence. But it is not magic. Small samples, noisy metrics, and wishful thinking can fool you.

Design

Hypothesis and metrics

A good A/B test starts with a clear, falsifiable hypothesis. For example: “If we make the sign-up button green, more people will click it because green feels action-oriented.”

Then you pick one primary metric to judge success. If you watch too many metrics, you might find one that looks better by chance and pretend your test succeeded. A primary metric keeps you honest.

Finally, you decide how big a difference matters. A 0.1% improvement might not be worth the effort, even if it is real.

Caution

Sample size and luck

Imagine flipping two coins five times each. One coin might land heads four times, the other only once. You cannot conclude that the first coin is “better” — you just have not flipped enough.

A/B tests work the same way. If only ten people see each version and three buy from B and two from A, the difference might be random noise. Teams run tests longer or use larger audiences to be more confident that a result is real.

There are formal statistical tools for this, but the takeaway is simple: bigger samples and clearer differences are more trustworthy.

Interactive

Run an A/B test

Pick a button color, run a simulated experiment, and see how the results change as the sample size grows.

CONTROL (A)
Buy Now

Existing blue button

VARIANT (B)
Buy Now

New green button

Per group: 500

Click “Run experiment” to generate results.
Check Yourself

Quick quiz

1. In an A/B test, what is the control?

2. Why are small sample sizes risky in A/B tests?

3. What is a primary metric?

Keep learning

A/B tests help you compare versions. But what if you want to release a new feature gradually to some users? Feature flags make that possible.

Part of the “Product Management & Decisions” series.