Skip to content
tezvyn:
Menu

A/B Testing: Calculating Your Sample Size

Source: Wikipedia: Sample size determinationMediumHow cards are made

Calculating A/B test sample size ensures your results are statistically significant, not just random noise. It's vital before testing anything from button colors to headlines. The biggest footgun is stopping a test early when a variant looks like it's winning.

Why it exists

Running an A/B test on too few users is like flipping a coin ten times and declaring it biased if you get seven heads. Random chance can easily create misleading results. Sample size determination was created to protect against making important decisions based on this statistical noise, ensuring that an observed effect is likely real.

The mental model

Think of sample size calculation as setting the rules for a fair race before it starts. You decide beforehand how long the race needs to be (the sample size) for a win to be meaningful. You don't stop the race early just because one runner takes a brief lead. This prevents you from declaring a winner based on a lucky start rather than true, sustained performance.

How it works

You don't typically do the math by hand; you use a calculator. But you need to provide the key ingredients. First, the baseline conversion rate: the performance of your current version. Second, the minimum detectable effect (MDE): the smallest improvement you'd consider meaningful. Third, statistical significance (alpha, usually 95%): your risk of a false positive. Fourth, statistical power (1-beta, usually 80%): your chance of detecting a real effect if it exists. The calculator uses these to tell you how many users you need in each group.

When to use it

Always perform this calculation before launching a controlled experiment comparing two or more variants. This applies to testing changes in user interfaces, marketing copy, algorithms, or any other user-facing experience. It is a foundational step in A/B testing, A/A testing (to validate your tools), and more complex multivariate tests.

When not to use it

Sample size calculation is for hypothesis testing, not for general exploration. You don't need it for qualitative feedback like user interviews, usability testing, or when you are simply monitoring metrics after a full launch. If a change is so subtle that it requires an enormous sample size, it may not be worth testing at all.

One canonical example

A SaaS company has a signup page with a 5% conversion rate. They want to test a new headline and decide a 0.5% absolute improvement (to 5.5%) is the minimum lift they care about. With 95% significance and 80% power, an online calculator would tell them they need about 25,000 users for the control group and 25,000 for the variant group. Running the test on only 5,000 users would risk missing a real win or declaring a random fluctuation as a success.

Interview question

What is the primary risk of not calculating the required sample size before launching an A/B test?

  • a.You might make important decisions based on random fluctuations instead of true effects.Correct
  • b.You will not be able to measure the minimum detectable effect (MDE) of your variant.
  • c.The experiment will always run for an excessively long duration, wasting valuable time and resources.
  • d.You will be unable to accurately determine the baseline conversion rate for your control group.
Why?

The card emphasizes that sample size determination protects against making decisions based on 'statistical noise' and 'misleading results' from insufficient data. Not calculating it means you risk mistaking random fluctuations for genuine improvements or declines. Options B and D refer to inputs for the calculation, not risks of omitting it, and option C describes a potential outcome that is not the primary risk highlighted, which is often stopping too early due to random leads.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on a/b testing — each one lists the topics its interview covers.

See open roles