Keyword density is the ratio of the number of times a keyword appears on a page compared to the page’s total word count. The simplest formula for keyword density is:
(Number of keywords/ Total number of words) * 100
So if your keyword appears 5 times in an article of 100 words, your keyword density will be 5%. A more complex method to measure keyword density is called TF-IDF (term frequency and inverse document frequency), which first calculates the standard keyword frequency and then offsets that number with an inverse document frequency number. This gives more weightage to the unique keywords and de-emphasizes commonly used words to arrive at a more precise figure.
In the early days of Google, keyword density provided a relatively objective way for Google to identify if a website was a good fit for the user. However, early SEOs exploited this algorithm by “keyword stuffing” or cramming as many keywords as they could into a piece of content, which led to garbled content that was of no use to a human reader. Google later clamped down on this practice with its Panda update and new algorithms that prioritized content that users would actually find useful.
Let’s get this straight: there is no ideal keyword density for better rankings. Google will not reward your page solely because of your keyword density. You’re better off creating natural content that a user actually wants to read and that answers their search query.
However, there are a few good rules you can follow for the ideal keyword density: