TF-IDF Calculator

Calculate term frequency, inverse document frequency and TF-IDF for a word in a document collection (raw and smoothed IDF).

Results

Enter your details and click Calculate to see your results.
About This Calculator

TF = count ÷ words in the document; IDF = ln(N ÷ df). Rare words in a collection get high IDF, so TF-IDF highlights words that characterise a document.

Example

Example: a word used 3 times in 100 words and found in 1,000 of 10 million documents has TF-IDF 0.27631021.

Assumptions

Natural log; smoothed IDF = ln((1 + N)/(1 + df)) + 1 (scikit-learn style).

Frequently Asked Questions

Why use the logarithm in IDF?

So very rare words don't dominate completely.

Related Calculators

About the Author

Imran Hossain
Imran Hossain

Professional SEO, Digital Marketer Specialist

I am a Certified Google Ads Expert And Professional SEO, Digital Marketing Specialist

View full profile