📄

TF-IDF Score Calculator

Calculate the TF-IDF (Term Frequency–Inverse Document Frequency) relevance score for a term in a document, used in information retrieval and NLP.

Results

TF-IDF Score0.057,322
Term Frequency (TF)0.025,000
Inverse Document Freq. (IDF)2.292,864

📖What is it?

TF-IDF measures how important a word is to a document in a collection. TF = (term count in doc) / (total words in doc). IDF = log(N / df) where N is the total number of documents and df is the number of documents containing the term. High TF-IDF means the term is frequent in the document but rare across the corpus — signalling relevance.

🎯How to use

Enter how many times the term appears in your document and the document's total word count. Then provide the corpus size and how many documents contain the term. Select the IDF variant — sklearn's variant (used by scikit-learn) adds smoothing to avoid division by zero.

💡Example scenario

The word "blockchain" appears 5 times in a 200-word article. The corpus has 1000 documents, 50 of which contain "blockchain". TF = 5/200 = 0.025. IDF = log(1000/50) = 2.996. TF-IDF = 0.025 × 2.996 = 0.0749.

🏆Pro tip

Words with very low IDF (appearing in almost every document) like "the" or "is" get near-zero TF-IDF scores — effectively filtering out stop words mathematically without a stop-word list. Compare TF-IDF scores across documents to rank their relevance for a search query.