# Sample Size Calculator for Two Groups

> Free sample size calculator for comparing two means or two proportions. Choose the difference to detect, power, significance level and allocation ratio, add loss to follow-up, and get a sentence for your methods section and R code.

Canonical: https://biostatkit.com/sample-size-two-groups

Find how many participants you need per group to compare two means or two proportions with the power you want. You get the number for each group, the expected 95% CI of the difference, a sentence for your methods section, and the R code.

## Methods wording

The sample size for comparing two independent groups was calculated with BiostatKit [1] using the normal-approximation formulas described by Lwanga and Lemeshow [2].

Method: normal-approximation sample size for two independent means or proportions, with allocation ratio and loss to follow-up.

## Frequently asked questions

### Where do I get the standard deviation?

From a pilot study or a published study in a similar population. If you only have a range, a rough guide is the range divided by 4, but a published value is better.

### Why does R's power.t.test give one more participant per group?

This page uses the normal approximation. power.t.test uses the t distribution, which asks for about Z squared over 4 more participants per group, roughly 1. For large groups the two agree. Report which method you used.

### Which allocation ratio should I choose?

Equal groups (ratio 1) need the fewest participants in total for the same power. A 2:1 ratio needs roughly 12% more participants in total for the same power; choose it only when there is a reason, such as wanting more safety data on the new treatment.

### Is the answer per group or in total?

Both are shown. The headline number is the total, and the line under it gives each group.

### Is my data stored or sent anywhere?

No. All calculations run in your browser tab. Nothing is uploaded, and the page works offline once loaded.

## Related calculators

- [Sample size for a proportion](https://biostatkit.com/sample-size-proportion)
- [Sample size: survival analysis](https://biostatkit.com/sample-size-survival)

Author: TS.BS. Vũ Duy Kiên (https://www.vuduykien.com)
