A/B test calculator: significance and sample size
Find out whether the gap between A and B is real or luck, with p-value and confidence interval, and work out how many visitors the test needs.
Your data never leaves your browser
A/B test calculator
Result
- Conversion rate A
- 5.00%
- Conversion rate B
- 6.20%
- Difference (B − A)
- +1.20%
- Relative lift of B
- +24.00%
- z statistic
- 2.610
- p-value
- 0.0091
- Confidence interval of the difference (95%)
- +0.30% … +2.10%
Result
- Visitors per version
- 8,158
- Total visitors
- 16,316
- Expected variant rate
- 6.00%
- Estimated duration
- 17
Computed to detect the MDE at the chosen power. If the real lift is smaller than the MDE, the sample is not enough.
How to tell whether your A/B test has a winner
An A/B test compares two versions of a page, ad or email to see which converts better. The risk is calling a winner too early: with few visitors, a gap of one or two points can be pure chance. This tool answers the two questions that matter: is the difference you saw real, and how many visitors do you need to see the difference you are looking for.
Everything is computed in your browser. The numbers you type are never sent anywhere.
- Enter visitors and conversions for A and B. Use the totals for the whole test period. A conversion is the action you measure: a purchase, a signup, a button click.
- Pick the confidence level. 95% is the industry default: it accepts a 1 in 20 chance of seeing a difference that does not really exist.
- Pick two-sided or one-sided. Two-sided asks whether there is a difference in either direction and is the safer choice. One-sided only asks whether B is better and must be decided before you look at the data.
- Read the p-value and the interval. If the p-value is below 1 minus the confidence (0.05 for 95%), the difference is significant. The interval shows the likely size of the lift; if it includes zero, the result is inconclusive.
- Plan the next test in the sample size tab. Enter the current rate, the smallest lift worth detecting (MDE) and the power. The tool returns how many visitors each version needs.
Everything is calculated here, in your browser. Nothing you type is sent to any server and we use no third-party cookies.
How the calculation works
Significance uses the two-proportion z-test. Assuming A and B convert equally, a single pooled rate is estimated and the distance between the two rates is measured in standard errors. The p-value is the probability of seeing a distance at least that large by chance alone.
The confidence interval of the difference uses the unpooled standard error, the same convention as Stata's prtesti command. The standard normal is computed with the error function, not with rough lookup tables.
Sample size uses the classic Fleiss formula for two proportions, the same one as Stata (power twoproportions). Checked against the Stata manual: rates of 0.001 and 0.015 with 80% power and 5% two-sided need 635 visitors per group.
- Rates
pA = conversions A ÷ visitors A; pB = conversions B ÷ visitors B - Pooled rate
p = (conversions A + conversions B) ÷ (visitors A + visitors B) - z statistic
z = (pB − pA) ÷ √( p × (1 − p) × (1/nA + 1/nB) ) - Two-sided p-value
2 × P(Z ≥ |z|), with Z standard normal - Confidence interval
(pB − pA) ± zc × √( pA(1−pA)/nA + pB(1−pB)/nB ) - Sample per group
n = ( zα × √(2 p̄ (1−p̄)) + zβ × √(p1(1−p1) + p2(1−p2)) )² ÷ (p2 − p1)²
Examples
A significant difference
A: 250 conversions out of 5,000 visitors (5.00%). B: 310 out of 5,000 (6.20%). The difference is +1.20 percentage points, z = 2.61 and p-value = 0.0091. At 95% confidence B won; the likely lift is between about +0.3 and +2.1 points.
Looks better, but it is chance
A: 20 conversions out of 400 (5.00%). B: 26 out of 400 (6.50%). B looks 30% better, but the p-value is about 0.36. The interval includes zero and the test is inconclusive: keep collecting data.
How much traffic do I need?
A current rate of 5% and a goal of detecting a 20% relative lift (from 5% to 6%) at 95% confidence and 80% power takes about 8,160 visitors per version, 16,320 in total. At 1,000 visitors a day, the test runs for 17 days.
Frequently asked questions
What is statistical significance in an A/B test?
It is evidence that the gap between A and B is not chance. At 95% confidence you only call a winner when the p-value is below 0.05, meaning a gap that large would show up by luck less than 5% of the time if the versions were equal.
How many visitors do I need for an A/B test?
It depends on the current rate and the smallest lift you want to detect. The smaller the lift, the larger the sample: detecting half the effect takes about four times the visitors. Use the sample size tab with your rate and your MDE.
What does a p-value below 0.05 mean?
It means that if A and B converted equally, you would see a gap this large or larger in fewer than 5% of tests. It is not the probability that B is better, and it does not tell the size of the lift: use the confidence interval for that.
Can I stop the test as soon as it turns significant?
No. Checking daily and stopping at the first low p-value inflates false positives a lot. Set the sample size beforehand with the sample size tab and only conclude once you reach it.
What are MDE and statistical power?
MDE is the minimum detectable effect: the smallest lift that would justify adopting the variant. Power is the chance the test detects that lift if it exists; 80% is the usual default. Higher power or a smaller MDE raises the required sample.
One-sided or two-sided test?
Use two-sided unless only one direction matters and you decided that before seeing the data. One-sided needs less sample but cannot detect that B got worse.
Related tools
ROAS calculator
Find out whether a campaign makes money: ROAS, the ROAS you need to break even, contribution margin and profit after ad spend.
ROAS calculatorMax CPA and LTV calculator
Find out how much you can pay per customer: break-even CPA, the CPA for your target LTV/CAC ratio, profit per customer and payback.
Max CPA and LTV calculatorFunnel budget planner
From sales goal to budget: how many leads and clicks you need and how much to spend on ads, with scenarios and rounding always up.
Funnel budget plannerUTM builder
Build campaign links in one consistent pattern and generate hundreds at once by pasting a list or CSV.
UTM builder