ForHosting KIT · Text & AI

Count unique words in text

“The cat sat on the mat. The cat was happy, and the mat was warm.” has 15 words but only 9 unique ones, with The leading at 4 uses. You see the total, the distinct count and the top ten words. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

The unique word counter reads a piece of text and answers two questions at once: how many distinct words it contains when case is ignored, and which words dominate it. You get the total word count, the number of unique words, and a ranked list of the ten most frequent words with their exact counts. It is the quickest way to profile a document before editing, indexing, or analyzing it — one call instead of a spreadsheet formula or a throwaway script.

What a unique word count tells you

Raw word count alone is a weak signal. A 500-word paragraph built from 480 different words reads very differently from one that repeats the same 40 words twelve times each, and the count unique words metric is what separates the two. Writers use it to spot repetition they stopped noticing; editors use it to judge vocabulary range; search specialists use it to see whether a page actually covers a topic or just circles one phrase.

This capability returns the unique count next to the total, so the ratio between them — often called lexical diversity — is one subtraction away. Because counting is case-insensitive, a sentence that opens with "The" and later uses "the" twice still counts as one unique word with three occurrences, which is what people almost always mean when they ask how many different words a text uses. Numbers count as words too, so a report dense with figures is measured honestly rather than silently discarding half its tokens.

How words are recognized and ranked

Tokenization is Unicode-aware: a word is a run of letters or digits in any script, optionally joined by internal apostrophes or hyphens, so "don't", "l'amour" and "well-known" each count as a single word while punctuation, emoji and whitespace act as separators. Every token is folded to lowercase before it enters the frequency map, and the first surface form seen is the one shown in the results, preserving the original spelling of your text.

The response lists the ten most frequent words in rank order with exact occurrence counts; when two words tie, the one that appeared first in the text ranks higher, which keeps the output stable and reproducible for the same input.

Where it fits in real workflows

The most common use is as a cheap pre-processing step. Before sending a document to an expensive model or a human reviewer, you profile it: is it long enough, is it repetitive, does the vocabulary match what you expected? Content teams run drafts through it to catch over-optimization, where one keyword appears fifty times in a thousand words.

Localization leads compare the unique-word counts of source and translated files to spot segments that were dropped. Developers building search or tagging features use the top-ten list as a first-pass keyword extractor before graduating to heavier machinery.

Measure lexical diversity of a draft

Compare unique words against total words to find repetitive writing before an editor does.

Profile content before indexing

Extract the ten most frequent words as candidate keywords for a search index or tagging pipeline.

Audit keyword density

Check whether a target phrase dominates a page beyond what reads naturally, with exact counts instead of guesswork.

Is the counting case-sensitive?

No. "Word", "word" and "WORD" count as the same unique word; the result shows the first form that appeared in your text.

What counts as a word?

A run of Unicode letters or digits, optionally joined by internal apostrophes or hyphens — so "don't" and "well-known" are single words. Numbers count too.

Why only the top 10?

The capability returns the total and unique counts for the whole text plus the ten most frequent words as a compact profile. That covers the common profiling use cases without shipping a full histogram.

Is the text stored?

No. It is processed in memory and discarded; only the counts are returned.

How do I measure the vocabulary range of a text?

Compare the number of unique words with the total. A paragraph built from mostly different words reads very differently from one that repeats the same few words, and the ratio between the two counts, often called lexical diversity, shows which one you have.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/text/count-unique-words

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/text/count-unique-words \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The cat sat on the mat. The cat was happy, and the mat was warm."}'
{
  "text": "The cat sat on the mat. The cat was happy, and the mat was warm."
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.count_unique_words",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How words are recognized and ranked

A text that contains no word tokens at all — say, only punctuation or emoji — is rejected with an invalid_input error instead of returning a misleading zero, so automated pipelines can tell the difference between an empty result and a bad request.

Where it fits in real workflows

The same code that powers the API runs free in your browser on this page, so you can paste a draft, check its profile, and only pay $0.002 per request when you wire it into an automated pipeline that needs the answer programmatically, at scale, and on every document that passes through.

What does it cost?

$0.002 per request via the API. It is also free to run in your browser on this page.

What happens with punctuation-only text?

If the text contains no word tokens at all, the request fails with an invalid_input error and is not billed.

Read the full KIT documentation →