Count word frequency
In «the cat sat on the mat and the cat ran», the comes first with 3 of 10 words (30%) and cat second with 2 (20%). Every word gets a rank, a count and a share, and ties are listed alphabetically. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- the cat sat on the mat and the cat ran
- Total words
- 10
- Unique words
- 7
This word frequency tool takes any non-empty text, splits it into words, counts how often each word appears, and returns a ranked list from most frequent to least frequent. Writers, editors, teachers, SEO practitioners, data analysts, and developers use ranked word counts for keyword audits, vocabulary range checks, simple bag-of-words features, classroom demos, and draft reviews before publication. The engine is fully deterministic: Unicode letter and digit tokens are extracted with a single regular expression, optional case folding lowercases keys by default, counts live in a hash map, and rows sort by count descending then word ascending so ties never flip between runs. There are no network calls, no sampling, and no date-dependent shortcuts.
What a word frequency ranking shows you
Word frequency ranking answers a practical product question: which words dominate this passage, how often each one appears, and what share of all tokens each word represents. A ranked frequency list is not the same as character counting, which measures length, and it is not the same as SEO keyword-density scoring against a single target phrase. Here every distinct word becomes a row with a rank, a count, a share equal to count divided by total words rounded to six decimal places, and a percent field for charts and spreadsheets.
Tokens are sequences of Unicode letters or digits, with optional internal apostrophe segments so contractions such as don't and names such as O'Brien stay whole when the source uses straight apostrophes. Punctuation, symbols, and bare whitespace act as separators and never receive their own rows. By default matching is case-insensitive: Hello, HELLO, and hello merge into one lowercased key so drafting noise does not inflate unique counts.
There is no stemming, no stop-word list, no language detection, and no machine-learning model that could drift between hosts.
Where ranked word frequencies fit in writing, teaching, and software
Students meet word-frequency work when a language arts prompt asks which terms dominate a speech, when a corpus lab builds a simple bag-of-words table, or when a coding exercise demands deterministic token counts before charting. Teachers can pre-generate answer keys that show expected ranks, counts, shares, and percents without trusting opaque spreadsheet formulas that split hyphenated words differently across locales. Editors and content teams paste drafts into a frequency ranking to spot accidental repetition, clichés that appear too often, or brand names that barely surface.
SEO and content strategists use the ranked list as a quick vocabulary audit before they open a full keyword-density workflow: the goal here is the full distribution of words from most to least frequent, not a single target phrase score. Support and operations teams measure noisy ticket subjects and log lines so dashboards can surface the most common failure words without custom parsers.
Pair it with character counters, slug tools, or keyword-density helpers when you are building a small lab of free, deterministic text utilities for forms, CMS prep, and data hygiene.
What you can do with it
Spot overused words in a draft
Paste an article or email and rank every word by frequency so you can cut repetition and tighten vocabulary before you publish.
Classroom and lab answer keys
Generate reproducible ranks, counts, shares, and percents for language-arts prompts, corpus labs, and coding exercises that demand exact tables.
FAQ
What does counting word frequency cost?
It is free in your browser on this page.
How are words split from punctuation?
Tokens are Unicode letter or digit runs, with optional internal apostrophes. Commas, periods, symbols, and whitespace separate words and never become rows.
Is matching case-sensitive?
By default no: Hello and hello count as the same lowercased word.
What happens if the text is empty?
Provide non-empty text that contains at least one letter or digit token.
How is rank decided when two words share a count?
Rows sort by count descending, then by word ascending, so ties break alphabetically and stay stable across runs.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/str/word-frequency \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"the cat sat on the mat and the cat ran"}'const res = await fetch("https://api.kit.forhosting.com/str/word-frequency", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "the cat sat on the mat and the cat ran"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/str/word-frequency",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "the cat sat on the mat and the cat ran"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/str/word-frequency", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"the cat sat on the mat and the cat ran"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"the cat sat on the mat and the cat ran"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/str/word-frequency", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "the cat sat on the mat and the cat ran"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "str.word_frequency",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Empty input, whitespace-only paste, and text with no letter or digit tokens are rejected with a clear invalid_input error so a blank form cannot become a silent empty success.
What word frequency ranking means and what the response contains
When you need case preserved for code samples or proper-noun studies, set case_sensitive true and the keys keep the exact spelling of each token. The response echoes the source text, reports total_words as the number of tokens found, unique_words as the number of distinct keys before any top cutoff, repeats the case_sensitive flag and the optional top limit, lists words in rank order from most to least frequent, and tags method as count_word_frequency for multi-tool pipelines. The engine either builds an exact ranked table inside the supported length or rejects the request with invalid_input. Rejected cases include a missing text field, a null value, an empty string, whitespace-only content, objects and arrays that are not plain text, payloads longer than the documented maximum character count, and strings that contain only punctuation with zero letter or digit tokens.
How the text field is read and how rankings stay reproducible
The value must be a non-empty string after a meaningful content check; finite numbers and bigints are stringified first so a bare product code typed as a number still produces a stable digit token. Outer spaces around real words are separators only; they do not create phantom tokens. Optional top accepts an integer from one to ten thousand and keeps only the first ranked rows after the full sort, which is useful when you want the head of a long distribution without shipping thousands of rare terms. Counting uses a single Unicode-aware tokenize pass, a Map for tallies, and a pure comparison sort—no network dictionary, no locale table that reorders letters differently across hosts, and no random sampling. The preferred field is text, but aliases input, string, value, content, and s are accepted so query strings, spreadsheets, and typed forms can reuse the same contract without renaming columns. Booleans, plain objects, and arrays are rejected with a clear message so a mistaken JSON body does not become the word true or an unhelpful object dump. Empty string and whitespace-only paste are always invalid_input: the product promise is count how often each word appears, not invent a zero success for a blank submit. Length is capped at one hundred thousand characters so a runaway paste cannot monopolize a Worker; longer payloads fail with an explicit limit message rather than a truncated silent cut. Optional case_sensitive defaults to false so everyday English drafts collapse case; set it true when you intentionally distinguish Hello from hello. Pair the free browser run on this page with the priced API when you need the identical frequency ranking inside an automated pipeline without shipping your own word counters.
Where ranked word frequencies fit in writing, teaching, and software
On this page the work runs entirely in your browser; through the API each successful analysis costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split—free interactive exploration and a priced, identical API—matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the numeric result.
Integration use cases
Bag-of-words test fixtures
Build deterministic frequency rankings for CI, search-index tests, and data pipelines without shipping a custom tokenizer.