A/B Test Calculator

A/B Test Calculator

Compare the conversion rates of two versions of a page, email or ad: see the uplift, whether it's statistically significant, its 95% interval and the chance B really beats A.

z = (p_B − p_A) ÷ √(p̄(1 − p̄)(1/n_A + 1/n_B))

Version A (control)
Version B (variant)
Enter the visitors and conversions for both versions

What is an A/B Test?

An A/B test shows two versions of something to randomly split visitors and compares how often each leads to an action, such as a sign-up or purchase. Randomisation means any real difference is down to the change, not the visitors.

Conversion rates bounce around by chance, especially with few visitors. The statistics here answer one question: is the gap between A and B bigger than that bouncing would produce?

Behind the scenes it's a two-proportion z-test. The page adds the uplift, a confidence interval for the size of the difference and the probability B is genuinely better, which is often what decision-makers actually want.

A/B Test Formula

Two-proportion z-test as given in OpenStax Introductory Statistics, section 10.3. See Sources.

1. Conversion rates and uplift

p_A = x_A ÷ n_A · p_B = x_B ÷ n_B · uplift = (p_B − p_A) ÷ p_A

2. Pooled test

p̄ = (x_A + x_B) ÷ (n_A + n_B)
z = (p_B − p_A) ÷ √(p̄(1 − p̄)(1/n_A + 1/n_B))

3. Interval and chance B is better

SE = √(p_A(1 − p_A)/n_A + p_B(1 − p_B)/n_B)
95% CI = (p_B − p_A) ± 1.96 SE · P(B better) ≈ Φ((p_B − p_A) ÷ SE)

The last figure uses a normal approximation equivalent to a Bayesian analysis with flat priors.

Worked Example: A New Checkout Button

Given:
Old button: 100 purchases from 1,000 visitors. New button: 125 from 1,000.
Step 1:
Rates and uplift:
10% → 12.5% · uplift +25%
Step 2:
Pooled test:
p̄ = 0.1125 · SE = 0.01413 · z = 0.025 ÷ 0.01413 = 1.77
Step 3:
p-value and interval:
p = 0.077 · difference −0.27 to +5.27 points
Result:
+25% uplift, but not yet significant

The interval still includes zero. The new button is probably better (about a 96% chance), but 2,000 visitors aren't enough to be confident. Detecting a lift from 10% to 12.5% reliably needs about 2,500 visitors per version.

Visitors Needed per Version

To detect each uplift from a 10% baseline with 80% power at 95% confidence (two-sided). Small uplifts need enormous tests.

Sample size per version for different uplifts
Uplift10% becomesVisitors per version
+5%10.5%57,763
+10%11%14,751
+20%12%3,841
+25%12.5%2,507
+50%15%686

Common A/B Testing Mistakes

  • Peeking and stopping early. Checking daily and stopping as soon as p dips below 0.05 greatly inflates false positives. Decide the sample size first.
  • Running too small a test. As the table shows, modest uplifts need thousands of visitors per version.
  • Testing many metrics and reporting the winner. With 20 metrics, one will usually look significant by chance. Pick one primary metric in advance.
  • Stopping mid-week. Behaviour differs by day. Run whole weeks so both versions see the same mix of days.

A/B Test FAQs

What does 95% significance mean here?

That if A and B truly converted equally, a gap this big would appear less than 5% of the time. It’s not a 95% chance B is better.

What is the “chance B is truly better”?

An approximate Bayesian probability that B’s true rate exceeds A’s, given the data. It’s often easier to act on than a p-value.

How long should I run a test?

Until you reach the sample size planned in advance, and for at least one full week. The power analysis calculator works out the size.

Do both versions need the same number of visitors?

No, but an even split is the most efficient use of traffic.

What if the result isn’t significant?

It doesn’t prove the versions are equal. Look at the interval: a wide one means the test was too small to tell.

Can I test more than two versions?

Yes, but compare each to the control with a multiple-testing correction, such as Bonferroni, or use a chi-square test across all versions.

What is relative uplift?

The change as a share of A’s rate. 10% to 12.5% is +2.5 percentage points but a +25% relative uplift.

Should I use one-tailed tests?

Usually not. A new version can be worse as well as better, and you want to know either way.

Sources

Related Tools