Sample Size Estimator Calculator

Plan QC sampling with clear confidence targets. Compare attribute and variable methods for your line. Export results, document assumptions, and audit decisions easily today.

Calculator

Choose attribute or variable sampling needs.
Two-sided confidence for estimation or tests.
Add N for finite population correction.
Useful when sample is a large fraction of N.
Use prior data or pilot results.
Half-width of the confidence interval.
Conservative when p is uncertain.

Example data table

Scenario Inputs Estimated n
Incoming inspection defect rate Confidence 95%, p=0.02, E=0.01, N not set ≈ 753
Conservative attribute sampling Confidence 95%, p=0.50, E=0.05, N not set ≈ 385
Measurement precision planning Confidence 95%, σ=1.5, E=0.5, N not set ≈ 35
Detect a mean shift Confidence 95%, Power 80%, σ=1.5, Δ=1.0, N not set ≈ 18
Finite lot inspection Confidence 95%, p=0.02, E=0.01, N=2000, FPC on ≈ 548
Values are illustrative and may differ slightly due to rounding.

Formula used

1) Defect rate (proportion) sample size

This estimates a sample size for a proportion using a normal approximation:

n₀ = (Z² · p · (1 − p)) / E²

Where p is expected defect rate, E is margin of error, and Z is the Z-score from the confidence level.

2) Mean (measurement) sample size for precision

This targets a confidence interval half-width around the mean:

n₀ = (Z · σ / E)²

Where σ is estimated standard deviation and E is the desired margin of error in measurement units.

3) Mean shift detection planning

For detecting a shift Δ with power, an approximate Z method is used:

n₀ = ((Zα/2 + Zβ) · σ / Δ)²

Zα/2 comes from confidence, and from the selected power.


Finite population correction (optional)

When the sample is a meaningful fraction of a finite population, adjust:

n = n₀ / (1 + (n₀ − 1)/N)

How to use this calculator

  1. Choose defect rate for pass/fail inspection, or mean for measurements.
  2. Set confidence level, then provide a margin of error or shift target.
  3. Add population size for lot-based inspection, if applicable.
  4. Press “Estimate Sample Size” to view results above the form.
  5. Download CSV or PDF to document assumptions and outcomes.

Confidence and inspection risk

Confidence level controls how often repeated samples bracket the true parameter. Using 95% corresponds to Z≈1.96, while 99% raises Z and increases n. In quality control, higher confidence reduces estimation risk but costs time and labor. Use higher confidence for safety‑critical parts, supplier disputes, or regulatory evidence. Use moderate confidence for internal trending, pilot studies, or rapid containment decisions on the shop floor. When sample costs are acceptable.

Precision for defect estimates

For defect sampling, the margin of error E sets the half‑width of the interval around p. Smaller E demands larger samples because n grows with 1/E². If historical p is unknown, selecting worst‑case p=0.5 produces the largest n and protects against under‑sampling. When p is small, use a realistic estimate from recent lots or a pilot run to avoid oversizing inspections and slowing material release. To protect throughput.

Finite lots and correction

When a lot is finite, sampling without replacement slightly increases information per unit. The finite population correction reduces n when n0 is not negligible relative to N. This matters most in small lots, expensive destructive tests, or 100% traceability situations. If N is huge compared with n0, the correction changes little. Record N and whether correction was applied for audit transparency and repeatable planning. At staged release gates.

Measurement sampling for averages

For variable data, precision planning uses n0=(Z·σ/E)², where σ reflects process spread. Estimate σ from control charts, capability studies, or a short pilot under stable conditions. If the process is not in control, σ inflates and the computed n may be misleading. Pair sampling plans with measurement system analysis and calibration. When units are meaningful, choose E based on tolerance, customer needs, and decision thresholds. For unit decisions.

Power for shift detection

Shift detection adds power by combining Zα/2 and Zβ, increasing n for stronger detection capability. Power represents the chance of detecting a true change of size Δ. Smaller Δ or higher power increases n quickly. Use this mode when you need to catch drift before defects rise, such as tool wear or chemical concentration changes. Align Δ with practical significance, and update σ as process improvements reduce variation.

FAQs

When should I use worst-case p=0.5?

Use it when defect rate is unknown or highly variable. It yields the largest proportion sample size, preventing under-sampling. Replace it with a realistic p after you collect pilot data or reliable historical inspection results.

How do I choose a practical margin of error E?

Pick E based on the decision you must make. Smaller E tightens the estimate but increases cost. For screening and trend checks, larger E may be acceptable. For release decisions, use tighter E aligned with risk.

When does finite population correction matter?

It matters when your planned sample is a meaningful fraction of the lot. If n0 is small compared with N, the adjustment is tiny. For small lots or destructive tests, it can reduce required sampling.

Where should σ come from for measurement sampling?

Use a stable estimate from control charts, capability studies, or a short pilot run with a capable measurement system. If the process is unstable or the gauge is noisy, σ may be inflated and the plan less efficient.

What does power mean in shift detection mode?

Power is the probability of detecting a true mean shift of size Δ under the stated conditions. Higher power lowers missed-detection risk but usually requires a larger sample. Choose Δ based on what is practically important.

Does this replace acceptance sampling standards?

No. It provides general statistical estimates for planning. If you must comply with a formal acceptance plan or industry standard, follow that plan’s rules and use this tool to support internal scoping and documentation.

Related Calculators

Survey Response RateMargin of ErrorConfidence Interval SurveySurvey Completion RateNet Promoter ScoreSurvey Participation RateResponse DistributionNonresponse Bias CheckSurvey Variance CalculatorSurvey Mean Score

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.