Sample Size Calculator

Sample Size Calculator — Determine Sample Size for Proportions, Means & Differences

Sample Size Calculator

A comprehensive tool for study design and power analysis.

1. Select Calculation Mode
2. Input Parameters (Proportion)
Best guess for the true proportion in the population. Use 0.5 for the most conservative estimate.
The acceptable amount of error in the estimate (e.g., 0.05 for ±5%).
3. Study Parameters
The desired level of confidence that the true parameter is within the confidence interval.
The probability of detecting an effect if it truly exists (typically 80% or 90%).
Ratio of sample sizes (n2/n1). 1.0 for equal groups.
4. Optional Adjustments
Use if sampling more than 5% of a known population. Leave blank otherwise.
Intra-class Correlation for cluster designs (0 to 1).
Average number of individuals per cluster.
Privacy Note: All calculations are performed in your browser. No data is sent to our servers.

Results

Required Sample Size (n)

...

...
Show Calculation Details

                

Power vs. Sample Size

What Is Sample Size and Why It Matters

Sample size, denoted as n, is the number of participants or observations included in a study. It is one of the most fundamental aspects of study design. An appropriately calculated sample size is crucial for several reasons:

  • Ethical Considerations: An oversized study exposes more participants than necessary to potential risks, while an undersized study is unethical because it lacks the power to produce meaningful results, wasting participants' time and resources.
  • Economic Efficiency: Studies cost time and money. A sample size that is too large is wasteful, while one that is too small prevents you from drawing valid conclusions, meaning the investment was futile.
  • Statistical Validity: The core purpose of a sample is to make inferences about a larger population. If the sample is too small, it may not be representative of the population, and the results will be unreliable. A sufficiently large sample size increases the statistical power of a study, which is the probability of detecting an effect if one truly exists.

How We Calculate Sample Size for Proportions and Means

The formulas for sample size depend on the type of data (proportions vs. continuous means) and the goal of the study (estimation vs. hypothesis testing).

Estimating a Single Proportion

When you want to estimate a population proportion (e.g., the percentage of voters who support a candidate) with a certain margin of error, the formula is:

n = (Z² * p * (1-p)) / ME²

Where Z is the Z-score for the desired confidence level, p is the estimated proportion, and ME is the desired margin of error. Since p is often unknown, a conservative approach is to use p=0.5, as this maximizes the required sample size.

Estimating a Single Mean

To estimate a population mean (e.g., average cholesterol level) with a given margin of error, the formula is:

n = (Z * σ / ME)²

Here, σ (sigma) is the population standard deviation. This value is often estimated from previous research or a small pilot study.

Comparing Two Groups (Hypothesis Testing)

When comparing two groups, the goal is to determine if a true difference exists between them. These calculations require specifying a desired level of statistical power.

For comparing two means, a common formula is:

n = 2 * ((Zα/₂ + Zβ)² * σ²) / Δ² (for each group, with equal allocation)

Where Zα/₂ relates to the significance level, Zβ relates to power, σ is the standard deviation, and Δ (delta) is the smallest effect size (difference in means) you want to be able to detect.

Power, Alpha, and Effect Size — What They Mean for Your Study

  • Significance Level (alpha, α): This is the probability of making a Type I error—rejecting the null hypothesis when it's actually true (a "false positive"). It is commonly set at 0.05, corresponding to a 95% confidence level.
  • Statistical Power (1-β): This is the probability of correctly rejecting the null hypothesis when it's false (avoiding a "false negative"). Power is typically set at 0.80 (80%) or higher. A higher power requires a larger sample size.
  • Effect Size (e.g., Δ or Cohen's d): This quantifies the magnitude of the difference you want to detect. A smaller effect size is harder to detect and thus requires a much larger sample size. Defining a meaningful effect size is a critical, context-dependent step in study planning.

Finite Population Correction, Design Effects, and Clustered Designs

Finite Population Correction (FPC)

Standard sample size formulas assume the target population is infinite. If you are sampling from a relatively small and known population (e.g., employees at a specific company), and your sample will constitute more than 5% of that population, you can apply the FPC to reduce the required sample size. The formula is: n_adj = n / (1 + (n-1)/N), where N is the total population size.

Design Effects (DEFF) for Cluster Sampling

In cluster sampling, you randomly sample groups (clusters) of individuals rather than individuals themselves (e.g., sampling schools instead of students). Individuals within a cluster are often more similar to each other than to individuals in other clusters. This similarity, measured by the intra-class correlation (ICC), reduces the statistical power. The Design Effect (DEFF) adjusts for this, increasing the required sample size: DEFF = 1 + (m-1) * ICC, where m is the average cluster size. The final sample size is n_adj = n * DEFF.

Frequently Asked Questions

Please see the structured data in the page header for a list of frequently asked questions and their answers.

Disclaimer: This tool provides estimates for planning purposes only and is not a substitute for formal statistical consulting. The validity of the results depends heavily on the accuracy of the input values. For critical research, clinical trials, or significant financial decisions, it is essential to consult with a qualified statistician.

© 2025. All rights reserved. For educational purposes only.