ForHosting KIT · Text & AI

Count unique words

“The quick brown fox jumps over the lazy dog. The fox is quick!” has 13 words but only 9 unique ones, because The and the count as one. You also get the type-token ratio and how many words appear just once. Free in your browser.

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

Counting unique words after case-folding answers a different question than a raw word counter: not how long the passage is, but how large its vocabulary is. Teachers, editors, SEO writers, and readability researchers paste a draft and want the distinct-token total so they can judge lexical richness, repetition, and whether a text is dense or padded. This unique-word counter tokenizes Unicode letters and digits, folds every token to lowercase, then reports the size of the resulting set together with the type-token ratio and how many words appear only once.

What unique-word count means after case-folding

A unique-word count answers a search intent people type every day: count unique words, vocabulary size of a text, how many distinct words after case folding, or lexical richness of a draft. This is not the same landing as a total word counter, which reports how many tokens appear including repeats, and it is not the same landing as a unique-word list, which returns the tokens themselves.

The product promise here is a number: how large is the vocabulary after every token is folded to lowercase so The and the share one type. A word is a contiguous run of Unicode letters or digits, optionally joined by an internal apostrophe or hyphen so contractions such as don't and compounds such as well-known stay one token. Everything else—spaces, commas, periods, emoji separators, and punctuation—is a boundary.

Scanning left to right, each token is lowercased and recorded in a frequency map; the unique count is the number of distinct keys. The type-token ratio is unique words divided by total tokens, a classic lexical-richness statistic. Hapax count is how many types appear exactly once; repeated count is how many types appear more than once.

Prefer this count-unique-words-total tool when you want vocabulary size for readability analysis. Do not use it for ranked SEO keywords, stemming, stopword removal, or sentence splitting—those landings serve other queries.

Readability and SEO copy checks

Editors compare vocabulary size across drafts so a landing page is neither monotone nor stuffed with near-duplicate phrases.

Are Hello and hello treated as the same word?

Yes. Every token is folded to lowercase before uniqueness, so Hello and hello share one type. There is no case-sensitive mode.

Is the unique-word counter free?

The browser tool runs free on your device.

What is the type-token ratio?

It is the number of unique words divided by the total number of words. In the fox sentence that is 9 out of 13, about 0.692308. The closer it gets to 1, the fewer words are repeated.

What does the count of words used only once mean?

It is how many words appear exactly once, also called hapax words. In the fox sentence there are 6, such as brown, lazy and dog, while the, quick and fox are the 3 repeated ones.

Are contractions and hyphenated words counted as one word?

Yes. An apostrophe or hyphen inside a word keeps it together, so don't and well-known each count as a single word. Spaces, commas, periods and other punctuation separate words.

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/str/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/str/count-unique-words \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The quick brown fox jumps over the lazy dog. The fox is quick!"}'
{
  "text": "The quick brown fox jumps over the lazy dog. The fox is quick!"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.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_chars100000
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.

Empty input is rejected with a clear validation error so pipelines never store a zero-length payload by accident.

Input contract, empty rejection, and reading the response fields

Whitespace-only text that is not empty is allowed: it may yield zero tokens and a unique count of zero, which is a valid success shape for punctuation-only or spacer-only input. There is no case-sensitivity switch: case-folding is the product promise, so Hello and hello always share one type. Because the algorithm is pure string logic, continuous-integration tests can pin the full object. Source text follows the same retention rules as other KIT parse items. Send a JSON body with the required string field text set to the non-empty sample you want measured. Aliases input, value, s, content, and body are accepted when older clients or form generators use those names. Missing text, a non-string value, or a zero-length string all raise invalid_input with a message that names the problem, and those failures are not charged on the prepaid API. On success the response includes count, unique_words, and unique_count as the same vocabulary size for SDK convenience, total_words as how many word tokens were seen before uniqueness, type_token_ratio as unique words divided by total words rounded to six decimals (zero when there are no tokens), hapax_count as types that appear exactly once, repeated_count as types that appear more than once, character_count as the UTF-16 length of the original string, original echoing the exact input for UI tables, and method always count_unique_words so downstream code can branch without sniffing shapes. Use count alone when a badge only needs vocabulary size; use type_token_ratio next to total_words when you want a quick sense of lexical richness versus repetition. Keep payloads to ordinary document sizes suitable for a Worker isolate rather than multi-megabyte dumps; this product is a text utility, not a bulk warehouse.

API usage, pricing, workflows, and practical limits

Call the free in-browser count unique words tool for homework vocabulary checks, style audits, readability scoring, and draft reviews without writing a split-and-Set one-liner in every language. Do not expect language detection, lemmatization, or multi-language stemming—those are separate problems with separate SEO terms. Authors shipping SDKs can document text as the only required field, show a success example with mixed-case repeats, and show an empty-string error example so integrators see both sides of the contract. Use the prepaid KIT API when a CMS, content pipeline, QA harness, tutoring app, or mobile client needs the same contract under balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. A typical workflow pastes a paragraph, reads unique_words and type_token_ratio, then compares against a reading-level target or a previous draft. Pair this endpoint with a word-frequency or keyword-density tool when the next step is ranking terms, but keep count unique words as its own landing so the vocabulary-size intent is not mixed with listing tokens or ranking SEO keywords.

Lexical richness of student drafts

Teachers paste an essay and read unique_words plus type_token_ratio to see whether the vocabulary is varied or padded with repeats.

CI fixtures for token pipelines

Build scripts pin unique-word golden outputs so case-fold and apostrophe regressions fail continuous integration immediately.

How do I count unique words in a text?

Send JSON with text set to a non-empty string. The response count, unique_words, and unique_count are the vocabulary size after case-folding.

What happens if text is empty?

The request fails with invalid_input. Empty input is not allowed; validation failures are not charged on the prepaid API.

What is type_token_ratio?

It is unique words divided by total word tokens, rounded to six decimals. Higher values mean less repetition. It is zero when the text has no word tokens.

Read the full KIT documentation →