Sample size calculator for A/B tests

Enter your current conversion rate and the smallest lift worth detecting to see how many visitors each version needs, or enter the visitors you have to find the smallest lift they can detect.

To detect a rise from 5.00% to 6.00%, each version needs 8,158 visitors, 16,316 in all.

At 1,000 visitors a day, that takes 17 days.

Example figures. Type over any of them.

Worked out from your other figures. Type here to set it yourself.
Worked out from your other figures. Type here to set it yourself.

Everything is worked out in your browser, and nothing you type is sent anywhere.

Use this in Google Sheets

Paste either formula into a cell.

With your numbers

=(NORMSINV(0.975)*SQRT(2*(5%+5%*(1+20%))/2*(1-(5%+5%*(1+20%))/2))+NORMSINV(0.8)*SQRT(5%*(1-5%)+5%*(1+20%)*(1-5%*(1+20%))))^2/(5%*(1+20%)-5%)^2

With current conversion rate (%) in A2 and smallest lift to detect (%) in B2

=(NORMSINV(0.975)*SQRT(2*(A2+A2*(1+B2))/2*(1-(A2+A2*(1+B2))/2))+NORMSINV(0.8)*SQRT(A2*(1-A2)+A2*(1+B2)*(1-A2*(1+B2))))^2/(A2*(1+B2)-A2)^2

What the result means

This is how many visitors each version needs before you read the result. Smaller lifts need far more visitors, so choose the smallest change you would act on. Then run the test to the end: stopping when it first looks significant makes a false result much more likely.

It uses 95% confidence and 80% power, the usual settings for A/B tests.

The formula

n = (1.96√(2m(1 − m)) + 0.84√(p1(1 − p1) + p2(1 − p2)))² ÷ (p2 − p1)²

n = visitors per version, rounded up. p1 = current rate, p2 = p1 × (1 + lift), m = (p1 + p2) ÷ 2. 1.96 and 0.84 are shown rounded; the calculator uses the exact values.

A worked example

A page converts at 5% and you want to detect a 20% lift, to 6%. Each version needs 8,158 visitors, 16,316 in all. At 1,000 visitors a day, the test runs for 17 days.

What incrementality testing is, and how a holdout measures it

Track your test's Google Analytics 4 sessions and key events in Google Sheets, refreshed on a schedule.

Start free

30 days of Plus, free from sign-up. No card needed.

Sign in with Google or a work or school Microsoft account.

Add to Google Sheets

Prefer to stay in Google Sheets? Add the add-on and start from the Extensions menu.