Compare proportion with a dichotomous outcome between two samples, using the Chi-squared statistic (or z test).

Your study includes Group 1 (exposed or active treatment) and Group 0 (unexposed or control treatment). You know P0 (outcome proportion in unexposed or control group) and either P1 (outcome proportion in exposed or active treatment group), RR (risk ratio), or OR (odds ratio).

If you don't know P0 but do know P (the prevalence of the outcome in the population) and Q1 (the proportion of exposed individuals in the population), and you can estimate RR, use this alternative calculator. Note the distinction between Q1 (proportion of exposed individuals in the population) and q1 (proportion of exposed subjects in your study).
Instructions: Enter parameters in the green cells. Answers will appear in the blue box below.
α (two-tailed) =
Threshold probability for rejecting the null hypothesis. Type I error rate.
β =
Probability of failing to reject the null hypothesis under the alternative hypothesis. Type II error rate.
q1 =
Proportion of subjects that are in Group 1 (exposed)
q0 =
0.500
Proportion of subjects that are in Group 0 (unexposed); 1-q1
P0 =
Risk in Group 0 (baseline risk)
Enter any ONE of the following three parameters (the other two will be calculated automatically):
P1 =
Risk in Group 1 (exposed)
OR =
Odds ratio
(P1/(1 - P1))/(P0/(1-P0))
RR =
Risk ratio (P1 to P0)
The standard normal deviate for α = Zα =
The standard normal deviate for β = Zβ =
Pooled proportion = P = (q1*P1) + (q0*P0) =
A = ZαP(1-P)(1/q1 + 1/q0) =
B = ZβP1(1-P1)(1/q1) + P0(1-P0)(1/q0) =
C = (P1-P0)2 =
Total group size = N = (A+B)2/C =
Continuity correction (added to N for Group 0) = CC = 1/(q1 * |P1-P0|) =
Sample size (with continuity correction)
N Outcome+ Outcome-
Group 1:
Group 0:
Total:
Sample size (without continuity correction)
N Outcome+ Outcome-
Group 1:
Group 0:
Total:
Note: This calculator uses the normal distribution (with and without the continuity correction) as an approximation to the binomial distribution.

References:
Hulley SB, Cummings SR, Browner WS, Grady D, Newman TB. Designing clinical research : an epidemiologic approach. 4th ed. Philadelphia, PA: Lippincott Williams & Wilkins; 2013. Appendix 6B, page 75.
(Continuity Correction) Fleiss JL, Tytun A, Ury HK. A simple approximation for calculating sample sizes for comparing independent proportions. Biometrics 1980;36:343-46.