Sample Size Calculator

This sample size calculator tells you how many participants you need. Choose whether you are estimating a proportion or a mean, or comparing two means or two proportions, and set your confidence level, margin of error and power.

Checks on your data

  • Sample-size formulas assume a simple random sample and that most invited people respond. Non-response or a convenience sample can bias the results by far more than the margin of error suggests.
  • This size is for detecting the difference you entered with the stated power. A smaller true effect needs a larger sample, so choose the smallest difference that would actually matter to you.

Results

Sample size per group (two proportions)
163
per group
Total across both groups
326
After 10% drop-out
364
total
z for α
1.96
z for power
0.8416
Confidence level
95 %
Per-group sample size rises with the power you demand
01002005060708090youPower (%)
Per-group sample size at different power levels
Powern per group
70%128
80%163
90%217
95%268
Show step-by-step solution
  1. p̄ = (0.3 + 0.45) ÷ 2 = 0.375; z(α/2) = 1.96, z(power) = 0.8416.
  2. n per group = [z(α/2)√(2p̄(1 − p̄)) + z(β)√(p₁q₁ + p₂q₂)]² ÷ (p₁ − p₂)² = 162.33.
  3. Round up to 163; allowing for 10% drop-out gives 182.
EstimatingMargin of error drives n
ComparingEffect size and power drive n
Standard targetsα 0.05, power 80%
AlwaysRound up, add drop-out

What Is Sample Size?

Sample size depends on what you want to learn. When estimating a value, it depends on the margin of error you accept and your confidence level. When comparing two groups, it also depends on the size of the difference you want to detect and the power of the test, which is the chance of detecting it if it is real.

The calculator covers four common cases: estimating a proportion, estimating a mean, comparing two means per group and comparing two proportions per group. It shows the z values used and the total across both groups for comparisons.

Below you will find the formulas, a variables table, a worked example and answers to common questions such as what power to aim for and how to choose the effect size.

How to Use the Sample Size Calculator

  1. Choose whether you are estimating one value or comparing two groups.
  2. Enter the quantities asked for: expected proportions or standard deviation and the margin or difference you need to detect.
  3. Keep α at 0.05 and power at 80% unless you have a reason to change them.
  4. Add an expected drop-out percentage so you recruit enough participants.
  5. Use the chart to see how sensitive the sample size is to your assumptions.

Sample Size Formula

Estimating a proportion

n=zα/22 p(1−p)e2n=\frac{z_{\alpha/2}^2\,p(1-p)}{e^2}

Estimating a mean

n=(zα/2 σe)2n=\left(\frac{z_{\alpha/2}\,\sigma}{e}\right)^2

Two means, per group

n=2 (zα/2+zβ)2 σ2δ2n=\frac{2\,(z_{\alpha/2}+z_{\beta})^2\,\sigma^2}{\delta^2}

Two proportions, per group

n=[zα/22pˉqˉ+zβp1q1+p2q2]2(p1−p2)2n=\frac{\left[z_{\alpha/2}\sqrt{2\bar p\bar q}+z_\beta\sqrt{p_1q_1+p_2q_2}\right]^2}{(p_1-p_2)^2}

Sample Size Variables Explained

SymbolMeaningNotes
nRequired sample sizeRounded up
z(α)Critical value for the confidence level
z(β)Critical value for the power
σ or pStandard deviation or proportionFrom a pilot or prior study
E or δMargin of error or difference to detect

Sample Size Worked Example

Using the example values (press “Load example” above to try them):

  1. p̄ = (0.3 + 0.45) ÷ 2 = 0.375; z(α/2) = 1.96, z(power) = 0.8416.
  2. n per group = [z(α/2)√(2p̄(1 − p̄)) + z(β)√(p₁q₁ + p₂q₂)]² ÷ (p₁ − p₂)² = 162.33.
  3. Round up to 163; allowing for 10% drop-out gives 182.

Result: Sample size per group (two proportions) = 163; Total across both groups = 326.

What power means and why 80%?

Power is the probability that your study will detect an effect of the size you specified, if it exists. At 80% power you accept a 20% chance of missing a real effect. Conventions of 80% or 90% balance the cost of recruitment against the cost of a missed finding. Underpowered studies waste resources and produce unreliable results, even when they happen to reach significance.

How inputs change the sample size
ChangeEffect on n
Halve the effect size to detectAbout 4 times larger
Halve the margin of errorAbout 4 times larger
Increase power from 80% to 90%About 30% larger
Reduce α from 0.05 to 0.01About 50% larger
Double the standard deviationAbout 4 times larger

Choosing the effect size

The most important and hardest input is the smallest difference worth detecting. Base it on the minimum difference that would matter in practice, previous studies or a pilot, rather than on a guess at the true effect. If you cannot defend the value, state the assumption openly.

Per-group n for a two-mean comparison (80% power, α = 0.05)
Cohen’s dDescriptionn per group
0.2Small393
0.5Medium63
0.8Large25
1.0Very large16

Drop-out and non-response

The calculated n is the number of participants who provide usable data. Divide by (1 − expected drop-out rate) to find how many to enroll. A 10% drop-out turns 100 required participants into 112 to recruit.

Assumptions behind the formulas

  • Simple random sampling and independent observations.
  • Normal approximation; for very small samples or extreme proportions, exact methods are better.
  • Equal group sizes for the two-group formulas; unequal allocation needs more total participants.
  • Two-sided test. A one-sided test needs a smaller n but is rarely justified.
  • Standard deviations and proportions are estimates; use pilot data or published values.

Where Sample Size Is Used

Research proposals

Justifying how many participants a study needs.

Surveys

Choosing how many responses to collect for a given margin of error.

Group comparisons

Planning a two-group experiment with a target power.

Trade-off checks

Seeing how a tighter margin or higher power changes the sample.

Common Sample Size Mistakes to Avoid

  • Do the power calculation before collecting data.
  • Be conservative with standard deviations.
  • Plan for drop-out and missing data.
  • Document your assumptions so reviewers can check them.

Sample Size Terms and Definitions

Power
Probability of detecting a true effect of the stated size.
Effect size
The difference you want to be able to detect, often standardised.
Type II error
Missing a real effect; probability β = 1 − power.

Sample Size FAQs

How do I calculate the sample size for my study?

Decide whether you are estimating or comparing, then supply the margin of error or the difference to detect, the variability, α and the power you want.

What is the minimum sample size for statistical significance?

There is no single minimum. It depends on the effect size, variability and desired power. Larger effects need smaller samples.

What is the difference between sample size for estimation and for comparison?

Estimation uses a target margin of error; comparison uses a target difference and power.

What power should I use?

At least 80%; 90% for important or hard-to-repeat studies.

Why does the sample size go up so fast for small effects?

The required n scales with the inverse square of the effect size. Halving the effect multiplies n by four.

Should I add extra participants for drop-out?

Yes. Divide the calculated sample by one minus the expected drop-out rate.

How does the margin of error change the sample size?

Sample size grows with the inverse square of the margin of error, so halving the margin of error needs about four times the sample. At 95 % confidence and p = 0.5, ±3 % needs about 1,068 responses and ±1 % needs 9,604.

What power should I aim for when comparing two groups?

80 % is a common convention and 90 % is used when missing a real effect is costly. Higher power needs a larger sample, so it is worth deciding on a realistic effect size before you start.

Related calculators

Last updated 2026-11-09. See our disclaimer.