Quality Control Sample Size Calculator

Determine the number of units to inspect from a production lot using the standard statistical sample size formula: n = Z^2 x p x (1-p) / e^2. A finite population correction is applied when the sample is a significant fraction of the lot size. This is used for attribute sampling (pass/fail inspection) in manufacturing quality control.

Total number of units in the lot being inspected
Expected defect rate (0.05 = 5%); use 0.5 if unknown
Acceptable error (0.03 = plus or minus 3%)
203.00 units
195.00 units
3.90%

Sample size formula

n(0) = Z^2 x p x (1 - p) / e^2
n(corrected) = n(0) / (1 + (n(0) - 1) / N)
Sample % = (n(corrected) / N) x 100

Where Z = z-score for confidence level, p = expected proportion defective, e = margin of error, N = lot size. Round up to the nearest whole unit.

Common z-scores for confidence levels

  • 90% confidence: Z = 1.645
  • 95% confidence: Z = 1.960 (most common in manufacturing)
  • 99% confidence: Z = 2.326
  • 99.5% confidence: Z = 2.576

Quality control sample size: frequently asked questions

What formula is used to calculate the required sample size for quality inspection?

The standard statistical sample size formula is: n = Z^2 x p x (1-p) / e^2, where Z is the z-score for the desired confidence level (1.96 for 95%), p is the expected proportion defective (use 0.5 if unknown, which gives the most conservative estimate), and e is the acceptable margin of error (e.g., 0.05 for plus or minus 5%).

What is AQL and how does it relate to sample size?

AQL (Acceptable Quality Level) is the maximum defect rate considered acceptable in a lot, per ANSI/ASQ Z1.4. The AQL table specifies code letters based on lot size and inspection level (I, II, or III), and the code letter maps to a sample size. This is the standard approach for incoming inspection in manufacturing.

What is the difference between confidence level and AQL?

Confidence level (e.g., 95%) is a statistical concept: if the same inspection were repeated many times, 95% of the intervals would contain the true proportion defective. AQL is a contractual acceptance criterion that defines the defect rate a customer is willing to accept. They serve different purposes in quality planning.

When should I use the finite population correction?

Apply the finite population correction when the sample is a significant fraction of the lot. Corrected n = n0 / (1 + (n0 - 1) / N), where n0 is the initial sample size and N is the lot size. If n0 / N is less than 5%, the correction is negligible.

What is inspection level II in ANSI/ASQ Z1.4?

Inspection Level II is the default level specified in ANSI/ASQ Z1.4 for normal inspection. Level I uses a smaller sample (lower discrimination), and Level III uses a larger sample (higher discrimination). Special levels S1-S4 are for destructive or costly tests where small samples are needed.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.