Defect Density Calculator

Defect density normalises a raw defect count by the size of what was inspected, so quality can be compared fairly across items of different sizes. In software it is often defects per thousand lines of code (KLOC); in manufacturing it can be defects per unit or per area. Enter the total defects and the size, and this calculator returns defect density per unit size. Add the number of defect opportunities per unit and it also computes defects per million opportunities (DPMO), the common Six Sigma quality scale.

0.00
0.00

Defect density formula

Defect density = total defects / size
Total opportunities = size * opportunities per unit
DPMO = (total defects / total opportunities) * 1,000,000

Defect density is defects per chosen size unit. DPMO scales the defect rate to a count per million opportunities, the standard Six Sigma quality unit.

Using defect density

  • Keep the size measure consistent across comparisons (always KLOC, or always units).
  • Defect density only reflects defects you actually found; inspection coverage matters.
  • DPMO maps onto Six Sigma levels referenced in NIST statistical guidance.
  • For software, defects per KLOC is the most common form.
  • For physical goods, defects per unit or per area inspected are typical.

Defect density: frequently asked questions

What is defect density?

Defect density is the number of confirmed defects divided by the size of the thing being measured, such as thousands of lines of code (KLOC), units produced, or area inspected. It normalises defect counts so different-sized items can be compared.

How do I calculate defect density?

Divide the total number of defects by the size measure. For software this is often defects per KLOC: 25 defects in 50 KLOC gives a defect density of 0.5 defects per KLOC.

What units can I use for size?

Any consistent size measure works: thousands of lines of code, number of units, square feet inspected, function points, or pages reviewed. Defect density is just defects divided by that size, so the result is defects per chosen unit.

What is DPMO?

DPMO is defects per million opportunities. If you also enter opportunities for a defect per unit, this calculator computes DPMO as defects divided by total opportunities times one million, a common Six Sigma measure.

Is a lower defect density always better?

Generally yes, a lower defect density means higher quality for a given size. The right target depends on the product, the criticality of failures, and the inspection coverage that produced the defect count.

Official sources

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