---
description: Defect Density is the number of defects confirmed in software/module during a specific period of operation or development divided by the size of the software/module. It enables one to decide if a piec
title: What is Defect Density? Formula to calculate with Example
image: https://www.guru99.com/images/defect-density.png
---

 

[Skip to content](#main) 

## What is Defect Density?

Defect Density is the number of defects confirmed in software/module **during a specific** period of **operation or** development divided by the size of the software/module. It enables one to decide if a piece of software is ready to be released.

Defect density is counted per thousand lines of code also known as KLOC.

## How to calculate Defect Density

A formula to measure Defect Density: 

Defect Density = Defect count/size of the release

Size of release can be measured in terms of a line of code (LoC).

## Defect Density Example

Suppose, you have 3 modules integrated into your software product. Each module has the following number of bugs discovered-

* Module 1 = 10 bugs
* Module 2 = 20 bugs
* Module 3 = 10 bugs

Total bugs = 10+20+10 =40

The total line of code for each module is

* Module 1 = 1000 LOC
* Module 2 = 1500 LOC
* Module 3 = 500 LOC

Total Line of Code = 1000+1500+500 = 3000

Defect Density is calculated as:

Defect Density = 40/3000 = 0.013333 defects/loc = 13.333 defects/Kloc

[](https://www.guru99.com/images/1-2015/pimgpsh%5Ffullsize%5Fdistr.png)

## A standard for defect density

However, there is no fixed standard for bug density, studies suggest that one Defect per thousand lines of code is generally considered as a sign of good project quality.

**Factors that affect the defect density metrics** 
* Code complexity
* The type of defects taken into account for the calculation
* Time duration which is considered for Defect density calculation
* Developer or Tester skills

## Advantages of defect density

* It helps to measure the testing effectiveness
* It helps to differentiate defects in components/software modules
* It is useful in identifying the areas for correction or improvement
* It is useful in pointing towards high-risk components
* It helps in identifying the training needs to various resources
* It can be helpful in estimating the testing and rework due to bugs
* It can estimate the remaining [defects](https://www.guru99.com/defect-management-process.html) in the software
* Before the release, we can determine whether our testing is sufficient
* We can ensure a database with a standard defect density

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/defect-density.png","url":"https://www.guru99.com/images/defect-density.png","width":"335","height":"200","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/defect-density-software-testing-terminology.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/softwaretesting","name":"Software Testing"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/defect-density-software-testing-terminology.html","name":"What is Defect Density? Formula to calculate with Example"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/defect-density-software-testing-terminology.html#webpage","url":"https://www.guru99.com/defect-density-software-testing-terminology.html","name":"What is Defect Density? Formula to calculate with Example","dateModified":"2024-04-24T19:52:51+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/defect-density.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/defect-density-software-testing-terminology.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/thomas","name":"Thomas Hamilton","description":"I am Thomas Hamilton, a seasoned professional in software testing, specializing in crafting comprehensive guides to help you master your software testing skills.","url":"https://www.guru99.com/author/thomas","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/thomas-hamilton-author-v2-120x120.png","url":"https://www.guru99.com/images/thomas-hamilton-author-v2-120x120.png","caption":"Thomas Hamilton","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"@type":"NewsArticle","headline":"What is Defect Density? Formula to calculate with Example","keywords":"testing","dateModified":"2024-04-24T19:52:51+05:30","articleSection":"Software Testing","author":{"@id":"https://www.guru99.com/author/thomas","name":"Thomas Hamilton"},"publisher":{"@id":"https://www.guru99.com/#organization"},"description":"Defect Density is the number of defects confirmed in software/module during a specific period of operation or development divided by the size of the software/module. It enables one to decide if a piec","copyrightYear":"2024","copyrightHolder":{"@id":"https://www.guru99.com/#organization"},"name":"What is Defect Density? Formula to calculate with Example","@id":"https://www.guru99.com/defect-density-software-testing-terminology.html#richSnippet","isPartOf":{"@id":"https://www.guru99.com/defect-density-software-testing-terminology.html#webpage"},"image":{"@id":"https://www.guru99.com/images/defect-density.png"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/defect-density-software-testing-terminology.html#webpage"}}]}
```
