Quick answer
Sample size (n) is the number of independent observations in a study, such as visitors per group in an A/B test. For comparing two conversion rates it is set by four inputs: baseline rate, minimum effect to detect, significance level and power. Halving the effect roughly quadruples n.
Formula: n per group = (z₁₋α/₂ + z₁₋β)² × [p₁(1 − p₁) + p₂(1 − p₂)] ÷ (p₁ − p₂)²; for α = 0.05 two-sided and 80% power, z values are 1.960 and 0.842.
What is sample size?
Sample size is the number of independent observations in a study, written n: the people surveyed, the visitors in each group of an A/B test, the orders in an audit. In a comparison between two groups it is usually quoted per group.
The useful question is not "what is sample size" but "how large must it be?" For a test comparing two conversion rates, the answer comes from four inputs and nothing else:
- Baseline rate: the conversion rate you have now.
- Minimum effect you want to detect: the smallest change worth acting on.
- Significance level (α): the false-positive rate you accept.
- Power (1 − β): the chance of detecting the effect if it is real.
Change any one of them and the required n changes, often a lot: halving the effect you want to detect roughly quadruples the sample. The rest of this page gives the formula, works it by hand for a 3.0% → 3.6% test and shows how n moves with each input.
The four inputs that set sample size
| Input | Typical choice | Where it comes from | Effect on n |
|---|---|---|---|
| Baseline rate p₁ | Your current rate, e.g. 3.0% | Last 4 weeks of data for the same page and audience | Lower baselines need more visitors |
| Minimum detectable effect | e.g. +20% relative (3.0% → 3.6%) | The smallest change that would change a decision | Halving it multiplies n by about 4 |
| Significance level α | 0.05, two-sided | Convention; stricter for high-stakes decisions | 0.01 instead of 0.05 adds about 49% |
| Power 1 − β | 0.80 | Convention; 0.90 when a miss is costly | 0.90 instead of 0.80 adds about 34% |
The conventions are not arbitrary. The ICH E9 guideline on statistical principles for clinical trials says the type I error is conventionally set at 5% or less and the type II error at 10% to 20%, that is, power of 80% to 90%. The minimum detectable effect and statistical power each have their own page; this one shows how they combine into n.
The sample size formula for comparing two proportions
For two groups of equal size, a two-sided test at level α and power 1 − β:
n per group = (z₁₋α/₂ + z₁₋β)² × [p₁(1 − p₁) + p₂(1 − p₂)] ÷ (p₁ − p₂)²
where p₁ is the baseline rate, p₂ the rate you want to be able to detect, and the z values come from the standard normal distribution:
| Setting | z value |
|---|---|
| α = 0.05 two-sided (z₁₋α/₂) | 1.960 |
| α = 0.05 one-sided (z₁₋α) | 1.645 |
| α = 0.01 two-sided | 2.576 |
| Power 80% (z₁₋β) | 0.842 |
| Power 90% | 1.282 |
The NIST/SEMATECH e-Handbook of Statistical Methods gives the closely related form for testing one proportion against a fixed value, with the two standard deviations weighted separately; both forms rest on the same normal approximation.
Worked example: 3.0% to 3.6% by hand
Sample data: a signup page converts 3.0% of visitors. The team wants to detect a lift to 3.6% (+0.6 points, +20% relative), two-sided α = 0.05, power 80%.
- Sum of z values: 1.960 + 0.842 = 2.802. Squared: 7.849.
- Variance term: 0.030 × 0.970 + 0.036 × 0.964 = 0.02910 + 0.03470 = 0.06380.
- Effect squared: (0.036 − 0.030)² = 0.006² = 0.000036.
- n per group = 7.849 × 0.06380 ÷ 0.000036 ≈ 13,911 (13,910.8 before rounding up, using unrounded z values).
So the test needs about 13,911 visitors per group, 27,822 in total. If 2,000 eligible visitors reach the page each day, that is 27,822 ÷ 2,000 ≈ 14 days, which conveniently covers two full weekly cycles. If only 500 a day reach it, the same test takes 56 days, and the team should either test a bigger change or pick a page with more traffic.
The 13,911 counts the experimental units the test randomizes, usually visitors, not sessions or pageviews. Counting sessions makes the sample look larger than it is.
How does sample size change with each input?
All rows keep the other inputs from the worked example (baseline 3.0%, two-sided α = 0.05, power 80%) unless the row says otherwise:
| Scenario | Rate to detect | n per group | vs example |
|---|---|---|---|
| +40% relative lift | 3.0% → 4.2% | 3,779 | 0.27× |
| +20% relative lift (example) | 3.0% → 3.6% | 13,911 | 1.00× |
| +10% relative lift | 3.0% → 3.3% | 53,208 | 3.82× |
| +5% relative lift | 3.0% → 3.15% | 207,935 | 14.95× |
| Power 90% instead of 80% | 3.0% → 3.6% | 18,623 | 1.34× |
| α = 0.01 instead of 0.05 | 3.0% → 3.6% | 20,699 | 1.49× |
| One-sided α = 0.05 | 3.0% → 3.6% | 10,958 | 0.79× |
| Baseline 6.0%, +20% relative | 6.0% → 7.2% | 6,716 | 0.48× |
| Baseline 1.5%, +20% relative | 1.5% → 1.8% | 28,300 | 2.03× |
Three rules of thumb follow, each visible in the table:
- Halving the effect roughly quadruples n. Going from +20% to +10% multiplies n by 3.8; from +10% to +5% by 3.9. The effect enters the formula squared.
- Halving the baseline roughly doubles n for the same relative lift (1.5% needs 2.0× the visitors of 3.0%).
- Stricter α and higher power cost less than a smaller effect. Moving to 90% power adds a third; moving to α = 0.01 adds about half.
A one-sided test needs 21% fewer visitors here, but it cannot detect a drop. Decide on one or two tails before the test, not after seeing the data.
Sample size for estimating a single rate
Not every question compares two groups. To test whether a single rate differs from a fixed value, the NIST e-Handbook (section 7.2.4.2) works this example: to detect a change from p₀ = 0.10 to p₁ = 0.20 with a one-sided α = 0.05 (z = 1.645) and power 0.90 (z = 1.282), N ≥ [(1.645 × √(0.1 × 0.9) + 1.282 × √(0.2 × 0.8)) ÷ 0.1]² ≈ 102, or 112 with a continuity correction. The same logic applies: the difference you want to detect sits in the denominator, squared.
Common mistakes with sample size
- Stopping when the result turns significant. Checking every day and stopping at the first p < 0.05 inflates false positives well above 5%. Fix n in advance and run to it.
- Confusing relative and absolute effects. "+20%" from 3.0% means 3.6%, not 23%. Write both the relative lift and the target rate.
- Quoting the total as if it were per group. 13,911 is per group; the test needs 27,822 visitors.
- Using a baseline from a different audience. A sitewide 3.0% rate for a test that only runs on mobile visitors, who may convert at 2.0%, understates the sample needed.
- Ignoring traffic that never reaches the tested element. If only 40% of page visitors scroll to the form being tested, the eligible traffic per day is 40% of the page's visitors.
For running the tests themselves, from hypothesis to readout, see CRO testing.
Getting sample size inputs from TapCub
TapCub does not split traffic or calculate sample sizes; it supplies the two inputs that depend on your own data, measured in the right unit:
- Read the baseline. In Web analytics › Goals, the goal's conversion rate is distinct visitors who completed it divided by distinct visitors in the range, the per-visitor unit the formula expects. Use four recent weeks, and filter to the page and audience the test will run on.
- Estimate daily eligible traffic. Web analytics › Pages shows visitors per page; divide the four-week total by 28 to get the daily figure for the duration estimate (2,000 a day in the example).
- Check how many visitors reach the tested element. If the change sits below the fold, All-platform analytics › Behavior › Heatmaps shows scroll depth, so you can discount visitors who never see it.
- Keep bots out of the counts. Bots detected by TapCub are counted separately and do not inflate visitor counts or lower the baseline rate.
- Mark the test window. Add the start and planned end date in Configuration › Annotations, so nobody reads the results before the planned n is reached.
See also: What is experimental probability? Formula and examples.
See also: Orthogonal array: definition and L4 / L8 examples in experiment design.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods. 7.2.4.2 Sample sizes required — sample size formula for a proportion; worked example N ≈ 102, 112 with continuity correction. Checked 2026-11-28.
- ICH. E9 Statistical Principles for Clinical Trials, Step 4 version dated 5 February 1998, section 3.5 — type I error conventionally 5% or less, type II error 10% to 20%. Checked 2026-11-28.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Engineer
Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.