ForHosting KIT · Text & AI

Count occurrences of a word

In “Blue skies look blue, but blueberry is not blue.” the word blue appears 3 times: blueberry is ignored because only whole words count, and capitals don't matter unless you ask. The total of 9 words gives context. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
Blue skies look blue, but blueberry is not blue.
Word
blue
You get
Quantity
3
Total words
9

Count how many times a specific word appears in a passage without accidentally counting it inside longer words. This whole-word counter is useful for writers checking repetition, editors tracking required terminology, teachers reviewing student work, and developers validating generated content. Matching is case-insensitive by default, so Word and word belong to the same count, while an optional case-sensitive mode keeps them separate. Unicode letters and digits are supported, including words with internal apostrophes. The result also reports the total number of recognized words, making it easy to understand the count in context.

How whole-word occurrence counting works

Whole-word matching answers a narrower and more practical question than searching for a sequence of characters. If the target is cat, a substring search might count cat inside catalog, education, or scatter, producing a misleading result. This tool first separates the supplied text into Unicode-aware word tokens and then compares every complete token with the requested word.

Runs of letters and digits form words, and an apostrophe inside a word is retained, which means contractions and names such as don't and O'Brien can be counted as a unit. Spaces, punctuation marks, line breaks, dashes, and other separators establish word boundaries. The algorithm scans from left to right and increments the result only when a complete token equals the target.

It does not stem words or merge grammatical forms, so edit, edits, edited, and editing remain distinct. That behavior is intentional: editors and automated checks usually need an exact, explainable count rather than a linguistic estimate. Identical inputs always return identical outputs because the capability uses no network, random values, external dictionaries, or current time.

Choosing case sensitivity and preparing input

Send text as a non-empty string and word as exactly one token. The target cannot contain surrounding spaces, commas, quotation marks, or multiple words; rejecting those ambiguous forms prevents a caller from believing that a phrase count is a word count. In that mode, BLUE, Blue, and blue all match the target blue after Unicode-aware lowercase normalization.

The output echoes the original target rather than rewriting it, so interfaces can display precisely what the user requested. Text may contain several paragraphs and punctuation-heavy prose, up to the declared limit of 100000 characters. A valid text that contains no matching target returns count zero; zero is a useful result, not an error.

Before automating an editorial rule, test a mixed-case sample and a longer word containing the target to confirm the chosen mode matches your policy.

Using the result in editing and automation workflows

For a quick check, paste a draft into the browser tool, enter the keyword, and read the whole-word count. A content editor can compare counts before and after a rewrite, a curriculum system can verify that a vocabulary word appears in an exercise, and a template test can assert that required terminology occurs at least once. Avoid treating a high count as proof of quality; repetition can indicate emphasis, compliance, or awkward writing depending on the document.

Also remember that exact matching does not combine plurals, inflections, synonyms, or differently punctuated phrases. If your policy needs several acceptable forms, call the capability once for each explicit target and combine the results in your application.

Keyword repetition checks

Writers count an exact keyword in a draft without including accidental matches inside longer words.

Editorial terminology audits

Editors verify that required terms appear and compare their usage across successive document revisions.

Automated content tests

Developers assert that generated pages contain a required whole word the expected number of times.

Does cat match catalog or scatter?

No. The counter compares complete word tokens, so a target is not counted when it appears only inside a longer word.

Can I count a phrase with several words?

No. The word field accepts exactly one word. Use a phrase-search capability when boundaries across several tokens matter.

What happens when the word does not appear?

A missing match is a valid result rather than an input error.

Does Blue with a capital count the same as blue?

Yes, by default capitals are ignored, so BLUE, Blue and blue all match. Switch on case-sensitive matching when capitals carry meaning, for example to tell US apart from us.

Are other forms of the word counted too?

No. Words are not reduced to a root, so edit, edits, edited and editing are four different words. Count each form separately if you need all of them.

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-word-occurrences

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-word-occurrences \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Blue skies look blue, but blueberry is not blue.","word":"blue"}'
{
  "text": "Blue skies look blue, but blueberry is not blue.",
  "word": "blue"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.count_word_occurrences",
  "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.

Processing is deterministic and local in the free browser tool, while API requests cost $0.002 per successful item.

How whole-word occurrence counting works

The response includes count, total_words, the submitted word, the selected case mode, and a method label.

Choosing case sensitivity and preparing input

By default, case_sensitive is false. Set case_sensitive to true when capitalization carries meaning, such as checking whether a product name always uses its approved styling or distinguishing US from us. Missing fields, empty strings, invalid target shapes, non-boolean case options, and oversized text return invalid_input. Aliases are available for common integration names, but new clients should prefer text, word, and case_sensitive because those canonical names generate the clearest SDK types and web form labels.

Using the result in editing and automation workflows

For repeatable pipelines, call the API at $0.002 per successful item and store the numeric count beside the document revision. The total_words field supplies useful context for simple ratios, although this capability deliberately does not calculate keyword density, rank every word, or recommend an SEO threshold. Those are separate analytical tasks.

Is matching case-sensitive?

It is case-insensitive by default. Set case_sensitive to true when uppercase and lowercase forms must be counted separately.

How much does the API request cost?

The browser tool is free. Each successful API item uses prepaid balance at $0.002; invalid input is rejected.

Read the full KIT documentation →