How Many Samples Does It Take to Trust a Batch?
October 12, 2026 · 7 min read
If you have any questions, feel free to comment below. Click the block can copy the code.
And if you think it's helpful to you, just click on the ads which can support this site. Thanks!
You have 1,000 items, but testing every one of them is expensive. How many should you randomly inspect: 10, 100, or half the batch?
There is no universal answer based on population size alone. As the NIST/SEMATECH e-Handbook explains[1], sample-size planning depends on the statistical objective and precision requirements. The useful question is: How many items do I need to estimate a proportion with a chosen level of precision? Under common assumptions, the answer is 278—not an arbitrary percentage of the batch.
Try the sample-size calculator #
Enter the total number of items available, not the number you have already tested. The default recommendation assumes 95% confidence, a margin of error of ±5 percentage points, and an unknown population proportion.
Assumes an unknown proportion (p = 0.5) and random sampling without replacement.
This is a planning estimate for a binary outcome, such as pass/fail, correct/incorrect, or defective/not defective. It assumes a simple random sample without replacement from a finite population. It is not a guarantee of finding rare defects, a machine-learning train/test split rule, or a batch acceptance plan.
First, decide what you want to learn #
Three questions that sound similar need different methods:
| Goal | Example | Appropriate approach |
|---|---|---|
| Estimate a proportion | What fraction of these records are incorrect? | Confidence level and margin-of-error planning |
| Detect a rare problem | How many inspections give a good chance of finding at least one defect? | Detection-probability calculation |
| Accept or reject a batch | Should we accept this shipment? | An acceptance sampling plan with acceptance/rejection rules |
The calculator above answers the first question. Calling its output the “optimal test count” would hide the assumptions that make it useful.
Where the formula comes from #
For a large population, the usual normal-approximation planning formula is:
$$ n_0 = \frac{z^2 p(1-p)}{e^2} $$Here:
- \(z\) is the standard-normal critical value: approximately 1.645 for 90% confidence, 1.96 for 95%, and 2.576 for 99%.
- \(p\) is the anticipated population proportion.
- \(e\) is the desired absolute margin of error. For ±5 percentage points, use 0.05.
When the proportion is unknown, use \(p=0.5\). This maximizes \(p(1-p)\), giving the most conservative sample size within this formula. It does not predict that half the items will fail.
For a known finite population of \(N\) items, apply the finite-population correction:
$$ n = \left\lceil \frac{n_0}{1+(n_0-1)/N} \right\rceil $$The calculator keeps the intermediate value unrounded and rounds the final result up. The recommendation never exceeds the population size.
At 95% confidence and ±5 percentage points:
$$ n_0 = \frac{1.96^2 \times 0.5 \times 0.5}{0.05^2} = 384.16 $$For 1,000 items, the correction gives about 277.74, so you should randomly inspect 278 items.
A practical reference table #
These counts all use the same defaults as the calculator:
| Total population | Recommended inspections |
|---|---|
| 100 | 80 |
| 500 | 218 |
| 1,000 | 278 |
| 10,000 | 370 |
| 100,000 | 383 |
| Very large or unknown | 385 |
The flattening is important. To estimate a proportion, you do not generally need to inspect a fixed percentage of every population. Once the population is large, the confidence level and margin of error dominate the calculation.
What confidence and error actually mean #
An estimated defect rate of 12% with a margin of error of ±5 percentage points means roughly 7% to 17%, not 12% ±5% of 12%.
A 95% confidence procedure means that, over repeated random samples, about 95% of the intervals constructed by that procedure would cover the true population proportion. It does not mean that 95% of the items pass, or that every estimate will be within five points of the truth.
This formula is an approximate planning tool, not an exact coverage guarantee. After collecting the data, use an appropriate interval method rather than blindly applying a symmetric normal interval, especially when failures are rare or counts are small.
Precision also has a price. For a very large population at 95% confidence, reducing the margin from ±5 to ±3 percentage points raises the recommendation from 385 to 1,068. Halving the margin roughly quadruples the large-population sample size.
A large sample cannot fix a biased selection #
The calculation assumes the selection process matches the statistical model. Testing the first 278 records, the easiest products to reach, or only one day’s output is not equivalent to drawing 278 items randomly.
A workable process is:
- Define the population and the pass/fail criterion before sampling.
- Give every item a unique identifier.
- Randomly select the required number of distinct identifiers.
- Test the selected items consistently and record all outcomes.
- Report the estimated proportion with its uncertainty and the sampling method.
If items come from different suppliers, categories, or time periods, consider stratified sampling so important groups are represented. However, subgroup precision, unequal sampling probabilities, and clustered observations require their own design calculations; the simple calculator does not account for them.
Rare-defect detection is a different problem #
Suppose you want a 95% chance of finding at least one defect if the true defect rate is 1%. Under independent trials with defect probability \(r\), the probability of observing no defects in \(n\) tests is \((1-r)^n\). Thus:
$$ n \geq \frac{\ln(1-C)}{\ln(1-r)} $$With \(C=0.95\) and \(r=0.01\), rounding up gives 299 tests.
This is a detection calculation, not a proportion-estimation calculation. For a fixed finite batch sampled without replacement, an exact calculation uses the hypergeometric distribution and an assumed number of defective items. Neither approach proves a batch has zero defects when none are observed.
Batch acceptance needs more than a sample count #
If the decision is “accept or reject this shipment,” use a suitable acceptance sampling plan[2], such as one based on ISO 2859-1[3], rather than treating the calculator’s result as a quality standard.
Such a plan specifies not just a sample size, but also acceptance and rejection thresholds, inspection conditions, and applicable switching rules. The lot size, inspection level, and acceptance quality limit (AQL) matter. AQL is not a promise that every accepted batch contains at most that percentage of defects.
For safety-critical testing or contractual inspections, follow the applicable standard and domain requirements.
The takeaway #
Choose the question first, then the sample size. If you want a practical starting point for estimating a binary proportion, use 95% confidence, ±5 percentage points, and \(p=0.5\), then apply the finite-population correction. If you need rare-defect detection or a formal acceptance decision, choose a method designed for that goal.
The illustrations in this article were created using the logic2image[4] skill.
References
Related readings
If you want to follow my updates, or have a coffee chat with me, feel free to connect with me: