Work out how many units, people or containers to sample. Choose a survey or proportion calculation (with the finite population correction), an estimate of a mean, or the WHO √N + 1 sampling plans for incoming materials. The calculator works at any confidence level and shows every step.

Sample size–

Which sample size calculation do you need?

SituationUse
Survey, questionnaire or estimating a percentage (for example the % of defective units, or the % of staff who pass a training test)Survey / proportion tab
Estimating an average value with a given precision (for example the mean fill weight within ±1 mg)Estimate a mean tab
Deciding how many containers of a starting material or packaging material to sample on receiptContainers to sample (WHO) tab
Accept/reject inspection of a lot by attributes (AQL)Use ISO 2859-1 / ANSI/ASQ Z1.4 tables (not covered by this calculator)

Sample size formula for a proportion

n₀ = z² × p × (1 − p) ÷ e²

Finite population correction: n = n₀ ÷ [1 + (n₀ − 1) ÷ N]

z = standard normal value for the confidence level (1.645 for 90%, 1.960 for 95%, 2.576 for 99%) · p = expected proportion (use 0.5 if unknown) · e = margin of error as a fraction · N = population size

Example: 95% confidence, ±5% margin of error, p = 0.5. Then n₀ = 1.96² × 0.25 ÷ 0.05² = 384.1, so 385 for a very large population. For a population of 500, n = 384.1 ÷ (1 + 383.1 ÷ 500) = 217.5, so you need 218.

Sample size formula for a mean

n = (z × σ ÷ E)²

σ = expected standard deviation (from historical data or a pilot study) · E = acceptable margin of error in the same units

Example: fill weights have σ ≈ 2.5 mg, and you want the mean within ±1 mg at 95% confidence. n = (1.96 × 2.5 ÷ 1)² = 24.0, rounded up to 25 units.

How many containers to sample: the WHO n, p and r plans

For incoming starting materials, WHO guidelines on sampling give three plans based on the number of containers (N) in the consignment.

PlanFormulaRoundingWhen it is used
n plann = 1 + √NSimple rounding. If N ≤ 4, sample every container.Uniform material from a recognized source
p planp = 0.4 √NRounded upUniform material from a recognized source, sampled mainly for identity testing
r planr = 1.5 √NRounded upMaterial suspected to be non-uniform or from a less well-known source; herbal materials

Example: 50 drums. √50 = 7.07, so n = 1 + 7.07 = 8.07 → 8, p = 0.4 × 7.07 = 2.83 → 3, and r = 1.5 × 7.07 = 10.6 → 11. Many regulators expect identity testing of every container of a starting material unless a validated, supplier-qualified reduced sampling procedure is in place (see EU GMP Annex 8). Follow your approved sampling SOP.

Choosing the inputs

  • Confidence level: 95% is the usual default. 99% gives a larger sample.
  • Margin of error: halving the margin of error roughly quadruples the sample size.
  • Expected proportion: if unknown, 50% gives the most conservative (largest) sample.
  • Population size: only matters when the sample is a large fraction of the population. For very large populations, leave it blank.

Common mistakes

  • Using a survey formula for lot acceptance. Accept/reject decisions need an attributes sampling plan (AQL), which also defines the accept and reject numbers.
  • Guessing σ. Use historical data or a pilot study, because the sample size depends on σ².
  • Forgetting that the sample must be random and representative. A large but biased sample is still wrong.
  • Applying a statistical sample size where GMP requires 100% testing, such as identity testing of each container.

Frequently asked questions

Why is the sample size 385 for a large population?

At 95% confidence (z = 1.96), ±5% margin of error and p = 0.5, n₀ = 384.1, which rounds up to 385. The size of a very large population barely changes this.

Does a bigger population always need a bigger sample?

Only up to a point. Above a few thousand, the required sample size hardly changes. The finite population correction mainly reduces the sample for small populations.

What is √N + 1 sampling?

It is the WHO “n plan” for sampling containers of uniform starting materials from a recognized source: n = 1 + √N, rounded to the nearest whole number.

Is this calculator suitable for clinical trial sample sizes?

No. Clinical trials need power calculations based on the effect size, the variability, the significance level and the power, usually done by a statistician.

Related tools and guides

References

  • WHO Technical Report Series No. 929, Annex 4: WHO guidelines for sampling of pharmaceutical products and related materials.
  • EU GMP Annex 8: Sampling of starting and packaging materials.
  • Cochran WG. Sampling Techniques, 3rd ed. Wiley.