Launch offer: 20% off your first quarter on any plan, until November 11.

--d--h--m--s
Claim it

Search engines & algorithmsAdvanced

TF-IDF

TF-IDF is a text statistic that scores a word highly when it is frequent in one document but rare across a collection. It is a poor SEO target.

Also called: Term frequency inverse document frequency, TF*IDF

TF-IDF stands for term frequency times inverse document frequency. It is a classic information retrieval technique for estimating how characteristic a word is of a document. Common words such as "the" appear everywhere and score low, while a word that is frequent in one page and rare elsewhere scores high. Some SEO tools use versions of it to compare pages, but matching a target score is unlikely to make a page rank.

Need help with SEO?

Comppound runs SEO and AI search for SaaS companies. We plan what to publish, produce it with AI, and every page passes automated checks, and a person reviews samples and anything high-risk.

  • Published to your site and tracked in Search Console
  • One person answers for your account
  • Plans from $400 a month, terms from 3 months

How the calculation works

The score multiplies how often a term occurs in a document by a measure of how rare it is across all documents. Implementations differ. The version below is the default documented by the scikit-learn library, which then also normalizes the resulting vectors.

tf-idf(t, d) = tf(t, d) x idf(t)

idf(t) = log((1 + n) / (1 + df(t))) + 1

n     = number of documents
df(t) = documents containing term t

Where it is used

TF-IDF remains a useful baseline for text classification, document similarity and internal site search. A close relative, BM25, is the default similarity in Elasticsearch, which describes it as TF/IDF based with built-in term frequency normalization. So the idea remains part of many search tools, which is different from saying it is a dial you can turn for Google.

Why it is a weak SEO target

TF-IDF tools usually compare your page's term use with the pages already ranking. That can reveal a subtopic you left out, which is useful. Treating the result as a number to match is much less so, because it copies competitors and invites unnatural repetition. Google has not published any TF-IDF target, its starter guide says you do not need every keyword variation, and its spam policies name keyword stuffing directly.

Example

Using the report as a prompt

Hypothetical database tool Ravensgill ran a TF-IDF report on its replication guide. The tool suggested using several terms more often, including "failover" and "replica lag."

An engineer pointed out that the guide never explained how to handle replica lag at all. The team added a section on that real gap and ignored the frequency targets, using the report only as a prompt for what to check.

Common mistakes

Editing to hit a target score

Adding a word more often does not add knowledge. Add the missing explanation, or leave the page alone.

Copying the top results' vocabulary

Top pages may rank for many reasons unrelated to their word use. Their terms are clues to investigate.

Assuming Google works this way

Google has described its language matching as sophisticated. A simple word-weighting model cannot stand in for its ranking systems.

Frequently Asked Questions

Google has not published a target or said that matching a TF-IDF score helps pages rank. Treat the tools as content prompts and do not read them as ranking models.

It weights terms for tasks such as text classification, similarity comparison and simple search. It is also a common starting point in information retrieval.

No. Keyword density only looks at one page. TF-IDF also considers how rare a term is across a whole collection of documents.

Keep reading

  • Keyword Density: Keyword density is how often a keyword appears relative to a page's total words. It was once tracked closely and is now considered an outdated metric.
  • LSI Keywords: LSI keywords are a popular SEO idea that Google ranks pages using latent semantic indexing. It doesn't; the useful part is covering related terms.
  • Semantic Keywords: Semantic keywords are terms and concepts closely related to a page's main topic. Covering them naturally helps show the page fully addresses it.
  • Embeddings: Embeddings are lists of numbers that represent the meaning of text, so a system can find passages that mean the same thing even when the words differ.
  • Expired Domain Abuse: Expired domain abuse is buying a lapsed domain and reusing its reputation to rank low-value content. Google added it to its spam policies in 2024.
  • MUM: MUM is a multimodal, multilingual AI model Google announced in 2021. Google says it powers specific search features rather than general ranking.
  • Needs Met Rating: Needs Met is the scale Google's quality raters use to judge how well a search result satisfies a query, from Fails to Meet to Fully Meets.
  • Neural Matching: Neural matching is a Google AI system, used since 2018, that links the concepts in a query to the concepts in pages even when the words differ.

Traffic dropped after an update? Let Comppound find out why.

We check what changed on the pages that lost ground, fix what is ours to fix, and tell you plainly what is not.