Skip to content
100% local

Lexical diversity calculator

Measure how varied a text’s vocabulary is with type-token ratio and related indices.

Input
Output

Lexical diversity calculator

Paste any text and this tool measures how varied its vocabulary is — a signal writers, editors, teachers and researchers use to spot repetitive phrasing or compare the richness of two passages. It counts the total words and the unique words, then reports the type-token ratio (TTR), its root variant (Guiraud's index) and its logarithmic variant (Herdan's C), plus a moving-average TTR that samples diversity across windows of the text so long documents aren't unfairly penalized just for having more words.

The options shape what counts as a distinct word. Ignore stop words to strip common function words like "the" or "and" before comparing, so the ratio reflects content words rather than grammar. Ignore case and diacritics to treat "Apple" and "apple" — or "café" and "cafe" — as the same word. Trim words to a base form applies a lightweight suffix-stripping heuristic tuned for English, so "running" and "runs" collapse toward "run", rather than full lemmatization. A minimum word length filters out short filler, the moving-average window controls how many words each diversity sample covers, and you can list as many of the most frequently repeated words as you like. Choose a plain-language summary or a tab-separated table depending on whether you're reading the numbers or pasting them into a spreadsheet.

Type-token ratio alone shrinks as a text gets longer, purely because words start repeating — that's why the root and logarithmic variants and the moving-average score exist, each correcting for length differently. Comparing all four side by side gives a fuller picture than any single number. The tool handles Windows (CRLF) and Unix (LF) line endings the same way, and the live tally under the output shows the word and unique-word counts alongside the plain TTR as you type.

Everything runs in your browser. Your text is never uploaded to a server, so it's safe to paste drafts, manuscripts or student essays. Copy the result, download it as a .txt file, or send the output back into the input to keep refining your analysis.

FAQ

What does the type-token ratio actually measure?
It divides the number of unique words by the total number of words. A higher ratio means less repetition — a wider vocabulary relative to the text's length.
Why does TTR drop for longer texts even when the writing style stays the same?
Every text eventually reuses common words like "the" or "and", so the ratio naturally shrinks as word count grows. Root TTR, log TTR and the moving-average TTR each adjust for this differently, which is why the tool reports all four.
What is the moving-average TTR window for?
It slides a fixed-size window of words across the text, computes the TTR of each window, and averages the results — a way of sampling diversity locally instead of letting one long document dilute the score.
How good is the "trim to base form" option?
It strips a small set of common suffixes (like "-ing", "-ed", "-s") and is tuned for English. It is a lightweight heuristic, not a full linguistic lemmatizer, so treat it as an approximation rather than a precise stem for every language.
Is my text uploaded anywhere?
No. The whole analysis runs locally in your browser — your text is never sent to a server.