English

How to Calculate Sample Size for Research: Step-by-Step Formulas, Power Analysis, and Examples

Work out sample size from the population and sampling method: Cochran and Slovin for surveys, power analysis for two groups, the analysis minimum, and non-response.

How to Calculate Sample Size for Research: Step-by-Step Formulas, Power Analysis, and Examples
Contents
  1. What decides the sample size?
  2. Step 1: Start from the question and the population
  3. Step 2: Choose a sampling method
  4. Step 3a: Calculate sample size for a survey (proportion)
  5. Is Slovin’s formula acceptable?
  6. Step 3b: Calculate sample size for comparing two groups (power analysis)
  7. Step 4: Check the minimum for your analysis
  8. Step 5: Add an allowance for non-response
  9. Sample size cheat sheet (95% confidence, p = 0.5)
  10. Frequently asked questions
  11. Is a sample of 30 enough?
  12. What if the population size is unknown?
  13. When should I survey the whole population instead?
  14. Does the pilot test count toward the sample?
  15. References

Short answer: calculate sample size in this order. (1) Define the research question and the target population. (2) Choose a sampling method. (3) For a random sample, apply a formula: for a survey estimating a proportion, n₀ = z²·p(1−p)/e², corrected for a finite population with n = n₀ ÷ (1 + (n₀ − 1)/N); for an experiment comparing two groups, use a power analysis. (4) Check the result against the minimum for your planned analysis. (5) Add an allowance for non-response. A population of 1,200 at a 5% margin of error and 95% confidence needs 292 respondents; detecting a medium effect (d = 0.5) between two groups at 80% power needs 64 per group.

When I supervise undergraduate and master’s theses, the first question about sampling is almost always tied to the software: “How many observations does regression need?” That question matters, but it comes last. A sample is meant to represent a population, and how it is drawn decides which formula is even allowed. The minimum for the analysis is a floor to check at the end, not the starting point.

The calculator below handles the most common case, a survey that estimates a proportion, such as the share of customers who are satisfied or the share of farmers who adopted a practice. Enter the population size, the margin of error you can accept, and the confidence level. The default values are a simulated example.

Quick version without the calculator: n₀ = 1.96² × 0.5 × 0.5 ÷ 0.05² = 384.16. For a population of N = 1,200: n = 384.16 ÷ (1 + 383.16/1,200) = 291.2, rounded up to 292. Slovin’s formula gives 1,200 ÷ (1 + 1,200 × 0.05²) = 300.

What decides the sample size?

Five inputs drive every sample size formula: the confidence level (how sure you want to be), the margin of error or the effect you want to detect (how precise), the variability in the population (how different the units are), the population size (only when it is small), and the sampling design. Software rules of thumb are a sixth, separate check. Change any one of them and the required sample changes, which is why a single “magic number” such as 30 or 100 cannot be defended in a methods chapter.

InputEffect on sample sizeWhere the value comes from
Confidence level (90%, 95%, 99%)Higher confidence → larger sampleConvention in your field; 95% is the default
Margin of error or effect sizeSmaller error or smaller effect → much larger sampleWhat difference would change a decision
Variability (p or σ)More variability → larger sampleEarlier studies or a pilot; p = 0.5 if unknown
Population size (N)Matters only when the sample is a sizeable share of NSampling frame (registry, membership list)
Sampling designCluster samples need more; stratified samples can need fewerYour sampling plan

Step 1: Start from the question and the population

Write down who the conclusions will apply to. “Smallholder rice farmers in three districts”, “nurses in public hospitals in one province”, or “first-year students at one university” are populations; “people near my campus” is not. Choose the location because the problem is real there, not only because it is convenient. Many students I supervise pick a site simply because their family lives nearby. That is fine when the research gap is also there, but the order matters: the gap decides the location, the location decides the population, and the population decides every number that follows.

Step 2: Choose a sampling method

Sample size formulas assume random selection. They measure how far a random sample is likely to fall from the true population value. With a non-random method, that margin of error has no statistical basis, so justify the sample with selection criteria or information saturation instead.

GroupMethodsHow to justify n
ProbabilitySimple random, systematic, stratified, clusterFormula or power analysis
Non-probabilityPurposive, quota, convenience, snowballCriteria, saturation, or the analysis minimum

Step 3a: Calculate sample size for a survey (proportion)

Use Cochran’s formula when the key result is a percentage. First compute the sample for a very large population, n₀ = z²·p(1−p)/e², where z is 1.96 for 95% confidence, p is the expected proportion, and e is the margin of error. If you have no prior estimate, use p = 0.5, which gives the largest and therefore safest sample. Then apply the finite population correction, n = n₀ ÷ (1 + (n₀ − 1)/N) (Cochran, 1977).

Worked example (simulated): a company of 1,200 employees, 5% margin of error, 95% confidence, unknown proportion. n₀ = 1.96² × 0.5 × 0.5 ÷ 0.05² = 384.16. With the correction, n = 384.16 ÷ (1 + 383.16/1,200) = 291.2, so survey 292 employees. Krejcie and Morgan’s (1970) widely used table lists 291 for the same population because it rounds to the nearest whole number. If an earlier survey found that about 20% of employees hold the view in question, the requirement falls to 205.

Is Slovin’s formula acceptable?

Slovin’s formula, n = N/(1 + N·e²), is common in theses in the Philippines and Indonesia. It gives 300 for the example above. It is Cochran’s corrected formula with two values fixed, p = 0.5 and z ≈ 2, so it works only for proportions at roughly 95% confidence. It cannot use a known proportion, a different confidence level, or a mean. The bigger problem in practice is using it with purposive samples, where no margin of error applies at all.

Step 3b: Calculate sample size for comparing two groups (power analysis)

For an experiment or a comparison between two groups, the question changes from “how precise” to “how likely am I to detect a real difference”. That probability is statistical power, conventionally 80%. Specify the smallest difference worth detecting (δ), the expected standard deviation (σ), the significance level α, and the power. The ratio d = δ/σ is Cohen’s effect size, where 0.2, 0.5, and 0.8 are often read as small, medium, and large.

Worked example (simulated): two teaching methods, where a 5-point gain on a test with a standard deviation of 10 points would matter. Then d = 0.5. With α = 0.05 (two-tailed) and 80% power, n = 2(1.96 + 0.8416)² ÷ 0.5² + 1.96² ÷ 4 = 63.8, so recruit 64 students per group, 128 in total. G*Power, the free program most researchers use for this (Faul et al., 2007), returns the same 64. The small final term is Guenther’s (1981) correction, which brings the normal approximation close to the exact t-test result.

Quick version: n per group = 2(z₁₋α/₂ + z₁₋β)² ÷ d² + z²₁₋α/₂ ÷ 4. For d = 0.5, α = 0.05, power 80%: 2(1.96 + 0.8416)² ÷ 0.25 + 0.96 = 63.8 → 64 per group.

Halving the effect you want to detect roughly quadruples the sample. Detecting d = 0.25 instead of 0.5 needs 253 per group, which is why the expected effect must come from earlier studies or a pilot, not from optimism.

Step 4: Check the minimum for your analysis

Compare the result with the requirement of the analysis you plan. For multiple regression, Green (1991) proposed N ≥ 50 + 8m to test the overall model and N ≥ 104 + m to test individual predictors, where m is the number of predictors. With four predictors, the floors are 82 and 108. If the sampling formula gives less than the analysis requires, use the larger number. The formula protects representativeness; the analysis minimum protects the test.

Step 5: Add an allowance for non-response

Divide by the expected response rate: n final = n ÷ (1 − r). With 10% expected non-response, 292 becomes 292 ÷ 0.9 = 324.4, so distribute 325 questionnaires. Online surveys often have much lower response rates than face-to-face interviews, so take r from a similar study in a similar setting.

Sample size cheat sheet (95% confidence, p = 0.5)

Population (N)Margin ±10%Margin ±5%Margin ±3%
100508092
50081218341
1,00088278517
5,00095357880
Very large973851,068

Values use Cochran’s formula with the finite population correction, rounded up. Notice how little the population size matters once it passes a few thousand: precision depends on the size of the sample, not on its share of the population.

Frequently asked questions

Is a sample of 30 enough?

Thirty is a rule of thumb for when the sampling distribution of a mean starts to look normal. It says nothing about whether the sample represents the population or has enough power. Calculate the requirement instead.

What if the population size is unknown?

Use the formula without the finite population correction, n₀ = z²·p(1−p)/e². At 95% confidence and a 5% margin of error, that is 385 respondents. Slovin’s formula cannot be used because it requires N.

When should I survey the whole population instead?

When the population is small and every unit is reachable. For a population of 60, the formula already asks for 53 at a 5% margin of error, so a census is simpler and removes sampling error.

Does the pilot test count toward the sample?

Usually not; pilot respondents should be similar to, but separate from, the main sample. See sample size for validity and reliability tests.

References

Cochran, W. G. (1977). Sampling techniques (3rd ed.). John Wiley & Sons.

Faul, F., Erdfelder, E., Lang, A.-G., & Buchner, A. (2007). G*Power 3: A flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods, 39(2), 175–191. https://doi.org/10.3758/BF03193146

Green, S. B. (1991). How many subjects does it take to do a regression analysis? Multivariate Behavioral Research, 26(3), 499–510. https://doi.org/10.1207/s15327906mbr2603_7

Guenther, W. C. (1981). Sample size formulas for normal theory t tests. The American Statistician, 35(4), 243–244. https://doi.org/10.1080/00031305.1981.10479363

Krejcie, R. V., & Morgan, D. W. (1970). Determining sample size for research activities. Educational and Psychological Measurement, 30(3), 607–610. https://doi.org/10.1177/001316447003000308

How to cite this article: Agung Budi Santoso (2026). How to Calculate Sample Size for Research: Step-by-Step Formulas, Power Analysis, and Examples. Catatan Budi. https://agungbudisantoso.com/en/how-to-calculate-sample-size-for-research/

Photo of Agung Budi Santoso

Written by

Agung Budi Santoso

Lecturer in Management & Agribusiness · Universitas Sumatera Utara

A lecturer and researcher who turns statistics, econometrics, and agribusiness research methods into practical, step-by-step notes for students and researchers.

Discussion

No comments yet. Have a question about this topic? Write it below and I will do my best to answer.

Leave a comment

Your email address will not be published.