BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Data Science

Term frequency: What TF measures and how to use it

Term frequency (TF) counts how often a word appears in one document. It's the first half of TF-IDF and the idea behind keyword density.

Monthly searches · term frequency
590
Keyword research data
term frequency
Term frequency: What TF measures and how to use it
Click the image to view it full size

In text analysis, a term is a word or phrase, and its frequency is a plain count: if "trail" appears three times in a product description, its term frequency (TF) in that description is 3. It's one of the oldest measures in text search and the starting point for TF-IDF, BM25 and keyword density.

TF looks at a single document. It says nothing about how common the word is elsewhere; that's what inverse document frequency adds.

How to calculate it

Take this ten-word example text:

Trail shoes for trail running. Choose trail shoes with grip.

"Trail" appears 3 times and "shoes" 2 times. Depending on the job, people turn that count into one of several numbers:

Variant Formula "trail" "shoes" Use it when
Raw count times the term appears 3 2 Documents are of similar length
Relative frequency count ÷ words in the document 0.3 0.2 You compare documents of different lengths
Binary 1 if present, 0 if not 1 1 Only presence matters
Log-scaled (sublinear) 1 + ln(count) 2.10 1.69 Repeats should count less and less

Relative frequency times 100 is keyword density: "trail" makes up 30% of this tiny text.

Text tools usually prepare the text first. They lowercase it, split it into words (tokens), and may drop stop words such as "for" and "with" or reduce words to a stem, so "running" and "run" count together (see stemming). These choices change the counts, so two tools can report different TF for the same page.

Why raw counts mislead

On its own, TF has two weaknesses.

Common words win. In almost any English text, "the", "and" and "of" have the highest counts. They tell you nothing about the topic. Search systems fix this by weighting each word by how rare it is across many documents, which is TF-IDF.

Repetition keeps scoring. With raw counts, the tenth mention of a word adds as much as the first. That's rarely how relevance works: a page that says "trail shoes" twice is about trail shoes, and saying it 20 more times doesn't make it ten times more so. Log scaling softens this. BM25, the default scoring in Elasticsearch, goes further: its term frequency saturates, so each extra repeat adds less, controlled by a setting called k1 (1.2 by default).

What term frequency means for SEO

Search engines still start with matching words. Google says the most basic sign that a page is relevant is that it contains the words of the query, for example in headings or body text.

But Google also says that someone searching for "dogs" doesn't want a page that says "dogs" hundreds of times, and that its systems look for other relevant content, such as pictures, videos or a list of breeds. Repeating a word to raise its count is keyword stuffing, which is against Google's spam policies. Google also says there's no ideal word count for ranking.

So use TF as a check, not a target:

  • Is the main term there at all? A page about trail running shoes that never uses that phrase, or a close variant, in its title, headings or body is harder to match.
  • Are the related terms there? A thorough page on the topic naturally mentions grip, drop, cushioning and terrain. TF comparisons against strong pages can show which subtopics you skipped.
  • Is anything overused? If one phrase dominates every sentence, rewrite for readers. There's no density figure to aim for.
Measure Looks at Answers
Term frequency One document How often does this word appear here?
Keyword density One document What share of the words is this term?
TF-IDF One document against a collection Is this word frequent here and rare elsewhere?
BM25 One document against a collection TF-IDF with saturation and length normalization, used for ranking

For how search engines combine these signals into ranking, see information retrieval and the vector space model.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.