FREE TOOL
Sample Size Calculator for Attribute and Variable Data
Work out how many parts to test or measure: reliability demonstration with zero or more allowed failures, estimating a defect proportion, or estimating a mean. Every step is shown so you can check it or paste it into a validation report.
Sample size calculator
Attribute data. How many units must pass to claim a reliability at a confidence level.
Test 29 units. Meeting the allowed number of failures demonstrates the stated reliability at the stated confidence.
| Step | Formula | Value |
|---|---|---|
| Confidence as a fraction | C = 95% / 100 | 0.95 |
| Reliability as a fraction | R = 90% / 100 | 0.9 |
| Success-run theorem | n = ln(1 − C) / ln(R) = ln(0.05) / ln(0.9) | 28.4332 |
| Round up | n = ⌈…⌉ | 29 |
Formulas used
- Reliability, zero failures (success-run theorem)
- n = ln(1 − C) / ln(R)
- Reliability, c failures allowed
- smallest n with Σ(k=0..c) C(n,k)·(1 − R)^k·R^(n − k) ≤ 1 − C
- Estimating a proportion
- n₀ = z²·p·(1 − p) / E²
- Estimating a mean
- n₀ = (z·σ / E)²
- Finite population correction
- n = n₀ / (1 + (n₀ − 1) / N)
Assumptions and limits
- C is the confidence level, R the reliability (proportion conforming) to demonstrate, z the two-sided standard normal value for C, E the margin of error and N the population or lot size.
- Reliability demonstration assumes each unit is an independent pass/fail trial with the same probability of failure (binomial model).
- The proportion and mean formulas use the normal approximation. For proportions near 0% or 100%, or very small samples, an exact binomial method is more appropriate.
- The mean formula treats σ as known. If σ comes from a small pilot study, a t-based calculation gives a slightly larger n.
- Results are always rounded up to the next whole unit.
Worked example
A supplier must show that a new crimp joint is at least 90% reliable with 95% confidence, and no failures are allowed during the test.
| Step | Formula | Value |
|---|---|---|
| Confidence as a fraction | C = 95% / 100 | 0.95 |
| Reliability as a fraction | R = 90% / 100 | 0.9 |
| Success-run theorem | n = ln(1 − C) / ln(R) = ln(0.05) / ln(0.9) | 28.4332 |
| Round up | n = ⌈…⌉ | 29 |
Result: Test 29 joints. If all 29 pass, the 90% reliability claim is demonstrated at 95% confidence.
How to choose the right sample size method
Attribute or variable data?
Attribute data is pass/fail or count data: a joint holds or breaks, a part is in or out of spec. Variable data is a measurement on a continuous scale, such as a diameter or a torque.
Measurements carry more information per part, so a variables approach usually needs fewer samples for the same decision. Use the attribute modes when all you can record is pass or fail.
Demonstrating reliability
Design verification and process validation plans often state a requirement as "R% reliability at C% confidence". The success-run mode gives the number of consecutive passes needed to support that claim.
Allowing one or more failures makes the test more forgiving if something goes wrong, but it raises the sample size. Decide the allowed failures before testing, not after you see the results.
Estimating a proportion or a mean
Use the proportion mode for questions like "what fraction of incoming parts have this defect?" If you have no prior estimate, 50% gives the largest, most conservative sample size.
Use the mean mode when you need to pin down an average, such as a fill weight or a bore diameter, to within ±E. You need a realistic σ from history or a pilot run.
When this is not the right tool
Lot acceptance against an AQL uses standard sampling plans (ANSI/ASQ Z1.4 or ISO 2859-1) rather than these estimation formulas. Use the AQL sampling calculator for that.
Capability studies need enough data to estimate the spread and are usually set by customer requirements. The Cpk calculator covers the analysis.
Common mistakes
- Mixing up confidence and reliability. 95% confidence of 90% reliability is a different claim from 90% confidence of 95% reliability, and the sample sizes differ widely.
- Deciding the allowed failures after testing. If a failure occurs in a zero-failure test, the plan has failed. Switching to a c = 1 plan afterwards invalidates the statistics.
- Using a margin of error in the wrong units. For proportions, E is in percentage points (5 means ±5%). For means, E is in the same unit as σ.
- Ignoring a small lot. When the sample is a large share of the lot, enter N so the finite population correction reduces n.
- Treating the sample as random when it isn't. Taking the first 30 parts off a fresh setup does not represent the whole run. Spread the sample across time, cavities, and shifts.
Frequently asked questions
How many samples do I need for 95% confidence and 90% reliability?
With zero failures allowed, 29 units, from n = ln(0.05) / ln(0.90) = 28.4, rounded up. Allowing one failure raises it to 46.
What is the success-run theorem?
It is the zero-failure case of the binomial distribution. If n independent units all pass, you can claim reliability R at confidence C when R^n ≤ 1 − C, which rearranges to n = ln(1 − C) / ln(R).
Why does 50% give the largest sample size for a proportion?
The variance term p(1 − p) is largest at p = 0.5. If you don't know the true proportion, 50% guarantees the sample is large enough whatever it turns out to be.
Is this the same as an AQL sample size?
No. AQL plans from ANSI/ASQ Z1.4 decide whether to accept a lot, using tables keyed on lot size and inspection level. This calculator estimates a quantity or demonstrates reliability from first principles.
When should I use the finite population correction?
When the sample is more than a few percent of the population, for example sampling 200 parts from a lot of 1,000. For very large or continuous production, leave the population blank.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods — sample sizes for estimating means and proportions, and binomial reliability testing.
- W. G. Cochran, Sampling Techniques, 3rd ed., Wiley, 1977 — sample size and finite population correction.
- P. J. Acklam, algorithm for computing the inverse normal cumulative distribution function — used for z values.
Results are computed in your browser from the published formulas named above. They are an engineering aid, not a substitute for the governing standard, your drawing, or your customer's requirements.