---
title: "TF-IDF"
description: "TF-IDF scores how important a word is to one page compared with many: high when common on the page but rare elsewhere. How SEO tools use it."
url: https://ursy.com/wiki/tf-idf/
updated: 2026-11-26T15:43:59+00:00
publisher: URSY (https://ursy.com/)
cite: Name URSY and link https://ursy.com/wiki/tf-idf/
---

# TF-IDF

> TF-IDF scores how important a word is to one page compared with many: high when common on the page but rare elsewhere. How SEO tools use it.

**TF-IDF (term frequency times inverse document frequency) is a score that shows how important a word is to one document compared with a whole set of documents: high when the word is common on that page but rare elsewhere.** It is one of the oldest ideas in [information retrieval](https://ursy.com/wiki/information-retrieval/). In [SEO](https://ursy.com/wiki/seo-search-engine-optimisation/) it turns up in content tools that compare your page with pages that already rank.

## What is TF-IDF? {#what-is-tf-idf}

It joins 2 counts:

- **Term frequency (TF):**  how often the word appears in this document.
- **Inverse document frequency (IDF):**  how rare the word is across the whole collection. A word found in every document gets an IDF near 0. A word found in very few gets a high IDF.

Multiply them and you get TF-IDF. Everyday words such as “the” or “and” score near 0 everywhere, because they are in every document. A word like “limescale” scores high on a descaling guide and 0 on a page about shoes.

The idea of IDF is credited to the computer scientist Karen Spärck Jones, who described it as “term specificity” in a 1972 paper, as the [Wikipedia article on tf-idf](https://en.wikipedia.org/wiki/Tf%E2%80%93idf) records.

## How does it work? {#how-does-it-work}

The textbook form uses N for the number of documents and df for how many of them contain the word:

```
idf = log(N / df)
tf-idf = tf x idf
```

Real software adds small changes. The scikit-learn library, widely used in Python, documents its [tf-idf term weighting](https://scikit-learn.org/stable/modules/feature_extraction.html) clearly. By default it uses:

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

Its documentation says the extra 1s act as if one extra document held every word once, which prevents division by zero. It then scales each document’s scores to the same length (L2 normalisation), so long pages do not win just by being long. It also explains the point of the whole method: words like “the”, “a” and “is” are very common but carry little meaning, and raw counts would let them drown out rarer, more useful words.

## Why does it matter for search? {#why-does-it-matter-for-search}

TF-IDF was a building block of early [search engines](https://ursy.com/wiki/search-engine/). It helped rank documents in a [search index](https://ursy.com/wiki/search-engine-index/) by how well they matched the words in a query. Modern engines use far more than that. [Google](https://ursy.com/wiki/google/)’s [How Search works](https://www.google.com/search/howsearchworks/how-search-works/ranking-results/) page says matching [keywords](https://ursy.com/wiki/keyword/) is the most basic relevance signal, then describes language models, a synonym system and checks for other relevant content beyond the keyword itself. It says a page that repeats a word too much is not what people want.

So TF-IDF is best seen as a writing aid, not a [ranking factor](https://ursy.com/wiki/ranking-factor/). SEO tools use it to compare your page with the top results for a query and list words those pages use that yours does not. That can reveal real gaps, such as a guide to kettles that never mentions “limescale”. It can also push writers to sprinkle in words for no reason. See [content gap analysis](https://ursy.com/wiki/content-gap-analysis/) and [content optimisation](https://ursy.com/wiki/content-optimisation/).

## Is it the same as keyword density? {#is-it-the-same-as-keyword-density}

No. [Keyword density](https://ursy.com/wiki/keyword-density/) is just one word’s share of a page’s words. It ignores the rest of the web. TF-IDF weighs each word by how rare it is across a collection, so it can tell a meaningful word from filler. Both share the same risk: chasing a number. Google’s [spam policies](https://developers.google.com/search/docs/essentials/spam-policies) list repeating words or phrases so often that it sounds unnatural as [keyword stuffing](https://ursy.com/wiki/keyword-stuffing/). Its [SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide) adds that repetition “even in variations” is tiring for users.

## Why does it matter for AI answers? {#why-does-it-matter-for-ai-answers}

Most [AI search](https://ursy.com/wiki/ai-search/) tools find passages with [embeddings](https://ursy.com/wiki/embeddings/) and [vector search](https://ursy.com/wiki/vector-search/), which compare meaning. Some retrieval systems still blend in word-matching scores from the TF-IDF family, because exact terms such as model numbers, product codes and place names matter. The practical lesson for [retrieval-augmented generation](https://ursy.com/wiki/retrieval-augmented-generation/) is the same either way: use the exact names of your products (each [entity](https://ursy.com/wiki/entity/)) and the exact words your customers use, once each where they fit. A page that says “our model” instead of the real model name is hard to match by words and by meaning. See [semantic search](https://ursy.com/wiki/semantic-search/).

## Common mistakes {#common-mistakes}

- **Treating the tool’s list as a quota.**  Adding a word 6 times because a rival used it 6 times.
- **Copying the top 10.**  If every page says the same thing, matching them makes yours the 11th copy. Original detail beats it. See [helpful content](https://ursy.com/wiki/helpful-content/).
- **Tiny or odd samples.**  IDF from 10 pages is noisy. Forums and shops in the same results skew the numbers.
- **Ignoring intent.**  A word may be common on ranking pages because they serve a different [search intent](https://ursy.com/wiki/search-intent/) from yours.
- **Forgetting the reader.**  The score cannot tell you if the page answers the question.

## A worked example {#a-worked-example}

Take a collection of 1,000 pages and a 500-word guide to descaling a kettle. Using log base 10 for easy numbers:

| Word | Times on the guide (tf) | Pages containing it (df) | idf = log(1,000 / df) | tf-idf |
| --- | --- | --- | --- | --- |
| the | 30 | 1,000 | 0 | 0 |
| kettle | 8 | 10 | 2 | 16 |
| limescale | 3 | 2 | 2.7 | 8.1 |
| water | 6 | 200 | 0.7 | 4.2 |

“The” appears 30 times but scores 0: it says nothing about the topic. “Limescale” appears only 3 times but scores highly because it is rare. Real tools use different formulas, as scikit-learn shows, so their numbers will differ, but the order of words is what matters.

## How to check it {#how-to-check-it}

1. Read your page next to the top results for the query. Note subjects they cover and you do not, not just words.
2. Check the topics your headings cover with the free [Heading Answer Gap Finder](https://ursy.com/webmaster-tools/heading-answer-gap-finder/) and the [Question Coverage Mapper](https://ursy.com/webmaster-tools/question-coverage-mapper/).
3. Count words with the [Word Counter](https://ursy.com/webmaster-tools/word-counter/) if you want to see repetition plainly.
4. Compare two of your own pages for overlap with the [Duplicate Content Comparer](https://ursy.com/webmaster-tools/duplicate-content-comparer/), or a rival’s page with [Compare Two Websites](https://ursy.com/compare-websites/).
5. Make sure the finished page reads well with our [Readability Checker](https://ursy.com/readability-checker/), and that its title and description say what it is with the [Meta Tag Checker](https://ursy.com/meta-tag-checker/).
6. In URSY Pro, the [Content brief builder](https://ursy.com/pro/content-brief-builder/) plans a page from real questions, and the [Plain English editor](https://ursy.com/pro/plain-english-editor/) keeps it readable.

## Questions {#questions}

### Does Google use TF-IDF? {#does-google-use-tf-idf}

Google does not publish its formulas. It says it uses keyword matching as a basic signal, plus language models and synonyms. Do not write for one formula.

### Is a TF-IDF tool worth using? {#is-a-tf-idf-tool-worth-using}

As a checklist of subjects you may have missed, yes. As a target to [hit](https://ursy.com/wiki/hit-analytics/), no.

### What is a good TF-IDF score? {#what-is-a-good-tf-idf-score}

There is none. Scores only mean something compared with other words and pages in the same collection.

## Related words {#related-words}

- [Keyword density](https://ursy.com/wiki/keyword-density/)
- [Keyword stuffing](https://ursy.com/wiki/keyword-stuffing/)
- [Natural language processing](https://ursy.com/wiki/natural-language-processing/)
- [On-page SEO](https://ursy.com/wiki/on-page-seo/)
- [Content optimisation](https://ursy.com/wiki/content-optimisation/)

## Sources {#sources}

- [scikit-learn: Feature extraction, tf-idf term weighting](https://scikit-learn.org/stable/modules/feature_extraction.html), checked 24 November 2026
- [Wikipedia: tf-idf](https://en.wikipedia.org/wiki/Tf%E2%80%93idf), checked 24 November 2026
- [Google: How Search works, ranking results](https://www.google.com/search/howsearchworks/how-search-works/ranking-results/), checked 24 November 2026
- [Google Search Central: Spam policies for Google web search](https://developers.google.com/search/docs/essentials/spam-policies), checked 24 November 2026
- [Google Search Central: SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide), checked 24 November 2026

*Updated 24 November 2026 by URSY.com.*
