A guide to determining the sample size for studies comparing success rates, response rates, or event proportions between two groups.
This calculator determines the number of subjects needed per group to detect a specified difference between two population proportions. It is applicable to randomised controlled trials, cohort studies, and any study comparing binary outcomes (e.g., response/no response, event/no event) between two independent groups.
The calculator supports three hypothesis frameworks: equality (is there a difference?), non-inferiority/superiority (is the new treatment not worse/better by a specified margin?), and equivalence (are the two treatments sufficiently similar?).
An optional continuity correction can be applied to account for the discrete nature of proportions when using the normal approximation. Unequal allocation ratios are also supported. Both options are explained in detail in Methods & Options below.
Two optional refinements are layered on top of the basic two-proportion formula. The continuity correction adapts the formula to the discreteness of real count data; the allocation ratio adapts it to real-world recruiting constraints. Each is unpacked below.
The count of “successes” in each group is a whole number — you cannot have 17.3 responders. The data are discrete: they jump in unit steps. But the standard formula uses the normal approximation, which assumes a smooth, continuous bell curve. This mismatch makes the approximation slightly optimistic — it suggests the test has more power than it actually does, so the calculated sample size comes out a little too small.
The continuity correction (Fleiss et al.) inflates the sample size by a small amount to compensate for the discreteness, using the \( n_c \) formula given in the Formula section. The correction is largest when sample sizes are small or when the two proportions are close together, and its effect shrinks as \( n \) grows.
In the worked example above (p0 = 0.60 vs p1 = 0.75), the correction raises the requirement from 150 to 163 per group — about 9% more — to genuinely achieve the specified 80% power.
By default, the formula assumes you will recruit the same number of subjects in each group (a 1:1 ratio — half treatment, half control). The allocation ratio \( r = n_2 / n_1 \) lets you plan a different split:
Equal allocation (1:1) is the most statistically efficient: it gives the smallest total sample size for a given power. Any deviation from 1:1 increases the total. Starting from the equal-allocation per-group size \( n_{\text{equal}} \), the group sizes become:
Worked example: suppose the 1:1 calculation gives 100 per group (200 total). With a 2:1 allocation (r = 2): n1 = 100 × (1 + 2)/(2 × 2) = 75 and n2 = 2 × 75 = 150, so the total rises to 225 instead of 200 — 12.5% more subjects than equal allocation, in exchange for having more subjects in Group 2.
The sweet spot: most clinical trials stay between 1:1 and 1:3. Beyond about 1:4 the returns diminish rapidly — adding more subjects to one group barely improves power, because the smaller group becomes the limiting factor.
A clinical researcher is planning a randomised trial comparing a new drug to the standard treatment for a skin condition. The standard treatment has a known response rate of p0 = 0.60 (60%). The new drug is expected to achieve p1 = 0.75 (75%). The study requires 80% power at a 5% two-sided significance level with equal allocation.
1 Open the Sample Size Calculator for Comparing Two Independent Proportions.
2 Select Hypothesis: Equality.
3 Set Significance Level (α) to 0.05 and Power to 0.80.
4 Enter Proportion in Group 1 (p0) as 0.60.
5 Enter Proportion in Group 2 (p1) as 0.75.
6 Keep Allocation Ratio at 1.
7 The result should be n = 150 per group (300 total) without continuity correction, or n = 163 per group (326 total) with continuity correction (the default).
Rounding up: n = 150 per group, matching Statulator’s output when the continuity correction is turned off.
The continuity correction compensates for using a continuous (normal) distribution to approximate a discrete (binomial) distribution. It slightly increases the sample size and is recommended for small to moderate sample sizes. The corrected sample size is:
| Output | Interpretation |
|---|---|
| Sample Size per Group | The number of subjects needed in each arm. With unequal allocation (r ≠ 1): Group 1 = n, Group 2 = n × r. |
| With/Without Continuity Correction | The corrected value is always equal to or larger than the uncorrected value. The correction is most important when the expected difference is small. |
| Non-Inferiority Margin | In non-inferiority designs, this is the largest acceptable amount by which the new treatment can be worse than the standard. A negative margin (e.g., −0.10) means the new treatment can be up to 10 percentage points worse and still be considered non-inferior. |
| Equivalence Margin | In equivalence designs, both treatments must be within ±δ of each other. The margin must be larger than the assumed true difference. |
For equivalence testing (two one-sided tests, TOST), the type II error is split between the two one-sided tests, so the critical value is \( z_{\beta/2} \) rather than \( z_{\beta} \).
where:
This calculator compares two groups, but many real studies have three or more arms — for example, a trial comparing control, drug 1, drug 2, and drug 3. Statulator does not yet have a dedicated multi-arm calculator; until it does, the two-group calculators can handle multi-arm designs with the recipe below. The same approach works for binary outcomes (this calculator) and continuous outcomes (the Two Independent Means calculator).
This is the most important question: “comparing k groups” can mean very different things, each leading to a different sample size. Decide before recruiting:
1 List the pairwise comparisons you actually plan to test (e.g., each drug vs. control = 3 comparisons in a four-arm trial).
2 Bonferroni-adjust the significance level: divide α by the number of comparisons c. For α = 0.05 and 3 comparisons, enter α = 0.05/3 ≈ 0.0167 in the calculator instead of 0.05.
3 Run the two-group calculator for the smallest difference you care about detecting — the hardest comparison is the one that drives the sample size. Sizing for the largest difference would leave the harder comparisons underpowered.
4 If different pairs involve different proportions, repeat the calculation for each pair and take the maximum per-group n. Apply that n to every arm of the study.
A four-arm trial (control, drug 1, drug 2, drug 3) with a binary response outcome. Expected response rates: control = 0.30, drug 1 = 0.40, drug 2 = 0.45, drug 3 = 0.50. Plan: compare each drug with control (3 comparisons) at overall α = 0.05 (two-sided) with 80% power.
1 Identify the smallest difference of interest: control vs. drug 1 (0.30 vs. 0.40, a 10 pp difference). This is the limiting comparison — the hardest to detect.
2 Bonferroni-adjust the significance level: α = 0.05/3 ≈ 0.0167.
3 Run this calculator with p0 = 0.30, p1 = 0.40, α = 0.0167, power = 0.80, allocation ratio 1. It returns approximately n ≈ 491 per group with the continuity correction (≈ 472 without).
4 Apply this n to all four arms: total ≈ 1,964 subjects.
An RCT compares a new antibiotic (expected cure rate 85%) to the standard treatment (cure rate 70%).
Inputs: p1 = 0.85, p2 = 0.70, α = 0.05 (two-sided), power = 80%, allocation ratio 1:1, continuity correction applied (default).
Result: n = 131 per group (262 total).
Interpretation: Enrolling 131 patients per arm gives 80% power to detect the 15 pp difference at the 5% significance level.
Researchers test whether a new teaching method increases the pass rate from 60% to 75%.
Inputs: p1 = 0.75, p2 = 0.60, α = 0.05 (two-sided), power = 90%, continuity correction applied (default).
Result: n = 213 per group (426 total).
Interpretation: Each classroom group needs 213 students for 90% power to detect the 15 pp improvement.
A government agency compares voter turnout between two outreach strategies: SMS reminders vs. no contact.
Inputs: p1 = 0.55, p2 = 0.48, α = 0.05 (two-sided), power = 80%, continuity correction applied (default).
Result: n = 825 per group (1,650 total).
Interpretation: The small expected difference (7 pp) requires a large sample. Each group needs 825 participants for adequate power.
A factory tests whether a new assembly process reduces the defect rate from 8% to 4%.
Inputs: p1 = 0.04, p2 = 0.08, α = 0.05 (two-sided), power = 80%, continuity correction applied (default).
Result: n = 599 per group (1,198 total).
Interpretation: Each production batch needs 599 inspected units to detect the halving of the defect percentage with 80% power.
Back to Sample Size Calculator for Comparing Two Independent Proportions