KONSİL

Calculator · deterministic

Survey sample size calculator (Cochran, Yamane)

Estimating a percentage within a margin of error: the sample a survey or prevalence study needs, with finite population, design effect and response rate.

Calculator

No AI, no sign-up — the arithmetic runs deterministically on the server, validated against an independent implementation (statsmodels) and published examples.

Enter 0–1: 0.30 for 30%. If you do not know it, use 0.5 — the value that gives the largest n, the cautious choice.
0–1: 0.05 for ±5%. The estimate will be off by no more than this.
95% is the convention; 99% raises n noticeably.
Enter it if the population is limited and known (a faculty's 1200 students). Leave empty if very large or unknown.
Above 1 in clustered/multi-stage sampling (e.g. 1.5). Leave empty for simple random sampling.
Not everyone answers a survey: 0.70 for 70%. The number to approach grows accordingly.

When to use it

Use this when you want to estimate a percentage within a margin of error: the “yes” rate in a survey, the prevalence of a disease or behaviour, satisfaction with a service. For most “how many people should I survey?” questions, this is the page.

If you will compare two groups (treatment vs control, A vs B) you need a power analysis instead: two proportions or two-sample t test. The difference: estimation sizes a study by precision (margin of error), comparison by power. Mixing them up puts the wrong number into an ethics application.

Where the inputs come from

  • Expected proportion (p): from a pilot or from publications with a similar population; cite the source. If you have no idea, enter 0.5: it gives the largest n, the cautious choice.
  • Margin of error (d): how far may the estimate be from the true proportion? ±5% is common. If the expected proportion is small (say 2%), ±5% is meaningless because the interval spills below zero; choose d relative to p.
  • Confidence level: 95% is the convention; 99% raises n noticeably.
  • Population size (N): only when the population is truly limited and known (a faculty's 1200 students, a hospital's registered patients). If the population is more than twenty times the sample, the correction barely changes the result.
  • Design effect: in clustered or multi-stage sampling (school → class → student) similar people cluster and inflate n; it is 1 for simple random sampling.
  • Response rate: not everyone answers a survey. The result is the number of people to analyze; the number you must approach is that divided by the response rate.

Worked example

You want to estimate how common a behaviour is among a faculty's 1200 students within ±5% at 95% confidence; you do not know the proportion, so p = 0.50. For a very large population the required number would be 385 (Cochran). Because the population is limited to 1200, the finite-population correction brings that to 292 people. With a 70% response rate you must approach 418 people. With the same inputs Yamane gives 300; the difference comes from Yamane fixing z = 2 (about 95.45% confidence).

In a rare-condition case, for example an expected prevalence of 2% with a margin of ±1%, Cochran's formula gives 753 while the Wilson interval needs 796. Do not trust the normal approximation when p is extreme.

Assumptions in this example (as declared by the solver): expected proportion p = 0.5; margin of error ±5%; confidence level 95% (z = 1.96); population N = 1200 (finite-population correction applied); response rate 70%.

Which formula, when?

Formulas for survey and prevalence sample size
FormulaAssumesWhen
Cochran (1977)
n₀ = z²·p·(1−p) / d²
A very large population.Most surveys and prevalence studies. You choose p and the confidence level.
Finite-population correction (Cochran; Krejcie–Morgan 1970)
n = n₀ / (1 + (n₀−1)/N)
The population is limited to N people.Matters when n exceeds 5% of the population. Algebraically identical to Krejcie–Morgan's explicit form (z²·p·(1−p)·N / (d²·(N−1) + z²·p·(1−p))).
Yamane (1967)
n = N / (1 + N·d²)
p = 0.5 and z = 2 (about 95.45% confidence), fixed.A quick shortcut. If your study's p or confidence level differs, the right number differs too; Yamane does not allow for that.
Wilson interval (Newcombe 1998)Drops the normal approximation.When p is below 10% or above 90%: the normal approximation can underestimate n.

The Krejcie–Morgan table, recomputed

The table below shows what the formula gives by population size for p = 50%, ±5% and 95% confidence: Krejcie and Morgan's 1970 table, recomputed here. The printed table rounds to the nearest integer; we always round up, so some rows show 1 more (for example, for N = 500 the printed table says 217, here 218).

People needed by population size (p = 50%, ±5%, 95% confidence)
Population (N)n
10080
250152
500218
1,000278
2,500334
5,000357
10,000370
50,000382
100,000383
1,000,000384

As the population grows, n levels off and approaches the infinite-population figure (385). Do not use this table for subgroups: each subgroup has its own population and its own n.

Common mistakes

  • Using it for a hypothesis test. This page estimates a proportion. Comparing two groups needs a power analysis; an n found for estimation is often too small for a comparison.
  • Applying the total n to subgroups. If you want ±5% separately by sex or department, each subgroup has its own population and its own n.
  • Forgetting the response rate. Approaching 385 people does not give 385 answers; at a 70% response rate you need 550.
  • Ignoring clustering. If you sample from clusters such as schools, classes or centres, the design effect inflates n.
  • Treating p = 0.5 as always right. It is cautious but expensive; with a trustworthy pilot proportion, a smaller n is enough.

How to write it in the protocol

Fill-in methods sentence

“The sample size was calculated with Cochran's formula (n = z²·p·(1−p)/d²) for an expected proportion of [outcome] of p = [value] [with source], a margin of error of ±[d] and [confidence]% confidence, giving n₀ = [n₀]. Because the population is [N], the finite-population correction (Krejcie and Morgan, 1970) was applied, giving [n]; anticipating a [response]% response rate, [target] people are to be approached.”

Sources

  1. Cochran WG. Sampling Techniques, 3rd ed. New York: Wiley; 1977.
  2. Krejcie RV, Morgan DW. Determining sample size for research activities. Educ Psychol Meas. 1970;30(3):607–610.
  3. Yamane T. Statistics: An Introductory Analysis, 2nd ed. New York: Harper & Row; 1967.
  4. Naing L, Winn T, Rusli BN. Practical issues in calculating the sample size for prevalence studies. Arch Orofac Sci. 2006;1:9–14.
  5. Newcombe RG. Two-sided confidence intervals for the single proportion: comparison of seven methods. Stat Med. 1998;17:857–872.

Related guides