Calculating keyword density

Keyword density (also search term density) describes how often a particular search term appears relative to all the words in a text. In the early years of search engine optimisation, it was considered an important lever, because search engines rated pages heavily on how often a keyword appeared in them. Rules of thumb such as “3 to 5 percent” circulated in the SEO industry. Google itself has never named an optimal value and today explicitly emphasises that there is no ideal keyword density. Modern search engines evaluate content by its meaning and topic coverage – not by counting words.
Calculating keyword density
The calculation is simple: divide the number of times a search term occurs by the total number of words and multiply by 100. If a term appears ten times in a 300-word text, the keyword density is 3.3%. With terms made up of several words, it becomes fuzzier because different tools count differently. For this reason alone, the value is at best a rough guide.
The fine line between natural text and keyword stuffing
Search terms show what topic a page is about and which search queries it matches. They should therefore appear in the important places – in the page title, the main heading and the text. But if a term is repeated unnaturally often, this is called keyword stuffing. It violates Google's spam policies and can cost rankings. Exactly where the line lies cannot be expressed as a percentage. A good test: does the text read naturally to a human, or are the repetitions noticeable? In addition, the frequency of a term is only a small aspect among very many ranking factors.
Meaning and topic coverage count for more than frequency
Instead of focusing on a percentage, texts should cover their topic completely and clearly. Thanks to modern language models, Google recognises semantics and topical relevance: synonyms, related terms, technical terms and connections show that a text really covers a topic. A guide to bean-to-cup coffee machines doesn't convince with the twentieth repetition of the main term, but with answers to questions about the grinder, milk system, cleaning and price. What Google evaluates today instead of keyword density is explained in more detail in the encyclopedia article “Keyword Density”.