TTKTheTextKit
On-Page SEO7 min read

What Is Keyword Density? Formula, Examples and Why There Is No Ideal Percentage

Keyword density is a keyword's count divided by total words. See the formula, four ways tools calculate it and what Google says about keyword stuffing.

By TheTextKit TeamPublished

Keyword density formula: the word keyword appears 4 times in 52 words, which is 7.7 percent

A card shows the formula count divided by total words times 100. Below it the worked example reads keyword, 4 divided by 52 times 100 equals 7.7 percent, with the number 4, the number 52 and the result in color.

Keyword density is how often a word or phrase appears in a text, shown as a percentage of all the words. It is easy to calculate and easy to misuse, because many guides give a "right" percentage that no search engine has published. This article shows the formula with a worked example, explains why two tools can give different numbers for the same text, and sets out what Google actually says. We also found and fixed a counting problem in our own checker, which is a good example of how easily the numbers go wrong.

The keyword density formula

The formula is the number of times the keyword appears, divided by the total number of words, times 100. As a worked example, we used a 52-word paragraph about SEO writing, which is the sample text in our Keyword Density Checker. With English stop words ignored, these were the top rows:

Word or phraseCountDensity
keyword44 / 52 = 7.7%
keyword density33 / 52 = 5.8%
density33 / 52 = 5.8%
search22 / 52 = 3.8%

A word that appears 4 times in 52 words is 7.7%. The same text would give 0.77% if it were ten times longer with the keyword still appearing 4 times, so density mostly tells you how long the text is. It is not a property of the topic.

Why two tools give different numbers

There is no standard formula, so tools differ. For the phrase keyword density, which appears 3 times in the same 52 words, we calculated four versions:

MethodResult
Count divided by all words5.8%
Count divided by words that are not stop words (46)6.5%
Count times 2 (words in the phrase), divided by all words11.5%
Count times 2, divided by words that are not stop words13.0%
Four keyword density formulas on the same 52-word text give 5.8, 6.5, 11.5 and 13.0 percent for one phrase

A table of four ways to calculate the density of the phrase keyword density in the same 52 words. Count divided by all words gives 5.8 percent. Dividing by words that are not stop words gives 6.5 percent. Multiplying by the two words in the phrase gives 11.5 and 13.0 percent.

One phrase, one text, four different percentages.

Our tool uses the first method, the count divided by all words. It is the simplest and the one most people mean. When you compare two tools, or follow a rule such as "keep it under 2%", check which formula is behind the number.

One word against a phrase

The number also depends on what you count. We wrote a 97-word product paragraph about a garden hose, in natural language, and counted it both ways. It reads:

Our garden hose is light and strong. Roll it out, water the lawn and roll it back in. It fits a standard tap and lasts for years. Many gardeners like the hose because it does not kink. The brass fittings keep the hose tight at the tap, and a spare washer is included in the box. Store the garden hose on a reel in the shed to protect it from frost. Rinse the hose after use, and it will stay supple through summer, autumn and winter. A full guide to care and storage comes with every order.

The counts were:

What we countedCountDensity
The single word hose55.2%
The phrase garden hose22.1%

Five mentions of one word in 97 words is above 5%, yet the paragraph reads normally because it says "the hose" after the first mention. Any rule that gives one percentage for every word fails in this way: pronouns, synonyms and the shortened form of a name all lower the count of the full phrase without making the text worse.

The same 97-word paragraph: the word hose is 5.2 percent and the phrase garden hose is 2.1 percent

A table for a 97-word paragraph about a garden hose. The single word hose appears 5 times, which is 5.2 percent. The phrase garden hose appears 2 times, which is 2.1 percent.

The same paragraph has two densities, depending on what you count.

What Google says about keyword density

Google does not publish an ideal percentage. Its spam policies define keyword stuffing as filling a web page with keywords or numbers to manipulate rankings in search results. Their examples include blocks of text that list the cities a page wants to rank for, and repeating the same words or phrases so often that it sounds unnatural. No percentage appears in them.

Google's SEO Starter Guide makes the same point from the reader's side. It says that repeating the same words over and over, even in variations, is tiring for users, and that this also breaks the spam policies. It asks for helpful, reliable, people-first content and suggests thinking about the words a reader might search for.

You will often read that 1 to 3% is the safe range. We could not find that figure in Google's spam policies or its SEO Starter Guide, and the earlier version of our own tool repeated it. We removed it. The new version shows the share of text only as a reading aid, with ranges that describe size and do not judge quality.

What keyword stuffing looks like

To see the difference, we wrote two versions of a short product text. The natural one had the phrase garden hose twice in 97 words, 2.1%. The stuffed one repeated it 13 times in 76 words, which is 17.1%. It begins like this:

Our garden hose is the best garden hose. Roll out the garden hose, water the lawn with the garden hose and roll the garden hose back in.

You don't need a tool to see the problem, but the number confirms it. A phrase that makes up one word in six is unlikely to be there for the reader.

Natural text has garden hose twice in 97 words, 2.1 percent; the stuffed text has it 13 times in 76 words, 17.1 percent

Two cards compare two versions of a product text. The natural text has 97 words and the phrase garden hose twice, which is 2.1 percent. The stuffed text has 76 words and the phrase 13 times, which is 17.1 percent.

The stuffed version repeats the phrase one word in six.

Counting words is harder than it looks

A density figure is only as good as the word count under it. The first version of our checker removed every character that was not a plain English letter, digit or space before it counted. That removed accented letters, so café was counted as caf. We tested four short texts and compared the new counter with Python's, which uses the Unicode definition of a letter:

TextWords (correct)Old checkerTop word in the old checker
French with accents3339caf
German with ä, ö, ü and ß2232nchen for München
Russian150none
English with curly apostrophes1620don for don't

The new counter matched Python on all four texts, in both total words and unique words. A Russian page would have shown no words at all. The curly apostrophes that word processors insert broke "don't" into pieces and stopped it matching the stop word list.

Word counts for four texts: the old checker gave 39, 32, 0 and 20 words, the correct counts are 33, 22, 15 and 16

A table of four sample texts with the correct word count and the count from the old checker. French has 33 words and the old checker gave 39. German has 22 and the old checker gave 32. Russian has 15 and the old checker gave 0. English with curly apostrophes has 16 and the old checker gave 20.

An English-only pattern miscounted three of four languages.

The fix also changed how phrases are counted. A phrase can no longer run across a full stop, a comma or a line break, because the last word of one sentence and the first word of the next are not a phrase. And a phrase can contain a stop word in the middle, such as "point of view", but cannot start or end with one.

How to use a keyword density checker

  1. Paste your finished text. Check it after you write, not while you write.
  2. Look at the top rows. Is the most repeated word or phrase the topic? If a filler word or an odd phrase tops the table, rewrite.
  3. Read the sentences with the top phrase. If the repetition sounds unnatural when read aloud, vary the wording.
  4. Compare with the plan. If an important phrase from your outline is missing, you may have drifted off topic. The Word Frequency Counter is another way to see which words repeat.
  5. Check the other pieces. Titles and descriptions have their own limits, which our meta description length guide covers.

What to do instead of chasing a percentage

  • Write for the question. Answer what the reader came to find, in the words they would use.
  • Use the phrase where it belongs. The title, the main heading, the first paragraph and the URL are natural places. Our guide to URL slug best practices shows how to do the last one.
  • Vary the wording. Synonyms and a shorter name after the first mention keep the text readable.
  • Cover the topic. Related terms, examples and numbers show a reader you know the subject.
  • Check repeated words. Accidental repeats such as "the the" are a separate problem, covered in how to find repeated words.

Frequently asked questions

What is a good keyword density?

Google gives no target. Its spam policies describe keyword stuffing as filling a page with keywords or numbers to manipulate rankings, and they name no percentage. The 1 to 3 percent rule that circulates online has no source from Google, so judge your text by how it reads.

How do you calculate keyword density?

Divide the number of times the keyword appears by the total number of words, then multiply by 100. A keyword that appears 4 times in a text of 52 words has a density of 4 divided by 52 times 100, which is 7.7 percent.

Is keyword density a ranking factor?

Google does not list it as one. Its SEO Starter Guide advises writing helpful, people-first content and warns that repeating the same words, even in variations, tires readers and breaks the spam policies. Cover the topic well and use the words a reader would use.

Why do two keyword density tools give different numbers?

They count differently. Some divide by all words and some leave out stop words. Some multiply a phrase's count by its number of words. On the same 52-word text, one phrase scored 5.8, 6.5, 11.5 or 13.0 percent depending on the method.

Does keyword density work for other languages?

Only if the tool counts words correctly. A simple pattern that reads only English letters turned café into caf and found no words at all in a Russian text. Check that accented and non-Latin words are counted before you trust the result.

Check your own text

Paste your draft into the Keyword Density Checker. It counts words from any alphabet, shows single words and phrases of two or three words, and gives each one's share of the text. Use the numbers to find repetition, and use your ear to decide whether it is a problem.

Try these free tools

100% in your browser

Keep reading

All articles →