Enter the number of defects and the number of lines of code into the Calculator. The calculator will evaluate the Defect Density. 

Defect Density Formula

DD = D / LC


  • DD is the Defect Density (defects/line)
  • D is the number of defects
  • LC is the number of lines of code

To calculate Defect Density, divide the number of defects by the number of lines of code.

How to Calculate Defect Density?

The following steps outline how to calculate the Defect Density.

  1. First, determine the number of defects. 
  2. Next, determine the number of lines of code. 
  3. Next, gather the formula from above = DD = D / LC.
  4. Finally, calculate the Defect Density.
  5. After inserting the variables and calculating the result, check your answer with the calculator above.

Example Problem : 

Use the following variables as an example problem to test your knowledge.

number of defects = 5

number of lines of code = 1000