ForHosting KIT · Text & AI

Count sentences in text

“Dr. Rivera arrived at 9 a.m. She reviewed version 3.14. Was it complete? Yes!” counts as 4 sentences: titles, times and decimal points don't end a sentence, and a last line without a period still counts. Free in your browser.

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

Count sentences in text without letting every period create a misleading result. This deterministic sentence counter recognizes periods, question marks, and exclamation marks as terminal punctuation while protecting familiar abbreviations, titles, initials, acronyms, and decimal numbers from accidental splits. Empty text is rejected clearly, and the browser experience uses the same pure counting logic as automated requests.

How sentence boundaries are detected

The counter scans the text from beginning to end and looks for the three common terminal marks: a period, a question mark, or an exclamation mark. Consecutive terminal marks, such as an excited exclamation followed by a question mark, form one boundary rather than several artificial sentences. Closing quotation marks and brackets do not create extra sentences.

After a real boundary, the next meaningful character begins a new candidate sentence. A meaningful final fragment also counts when a writer omits its closing punctuation, which is common in notes, form responses, headings, and informal messages. Empty strings and strings containing only whitespace are rejected instead of being reported as zero, because a missing submission is different from valid prose with a measurable result.

The implementation is deterministic and performs no language-model inference, network request, random operation, or time-dependent calculation.

How abbreviations avoid false splits

A period does not always finish a sentence, so the scanner protects several patterns before treating it as terminal punctuation. Common titles such as Mr., Mrs., Ms., Dr., Prof., Capt., and Sen. remain attached to the name or phrase that follows. Familiar Latin and business abbreviations, month names, time markers such as a.m. and p.m., single initials, and multi-part acronyms such as U.S. are also recognized in contexts where the text clearly continues.

Periods between digits are treated as decimal points, preventing a number such as 3.14 from becoming two sentences. These rules address frequent false boundaries without introducing probabilistic guesses or hidden external dictionaries. Context still matters: an abbreviation that can naturally appear at the end of a sentence may act as a boundary when the following text looks like a new sentence.

No compact rule set can interpret every specialized abbreviation or every intentionally unconventional style, but this approach is transparent, stable, and substantially more accurate than simply splitting on every period. For best results, provide normal prose with spacing between sentences and review highly technical material containing unusual domain-specific shorthand.

Using the result in writing and automation

Writers can compare drafts against paragraph-length requirements, editors can spot sections that are unusually dense, and teachers can validate minimum or maximum sentence targets before reviewing the substance of an answer. Product teams can use the count to enforce concise descriptions, support replies, survey responses, or onboarding prompts. Localization teams can compare source and translated totals as a lightweight warning that a clause may have been dropped or merged, while recognizing that languages and translation choices do not always preserve a one-to-one sentence relationship.

Developers can add the response to content-quality pipelines because the function is pure, bounded, and safe to retry. Treat the number as a structural measurement rather than a grammar judgment: the tool identifies likely sentence endings but does not rewrite punctuation, assess clarity, score readability, or decide whether a fragment is stylistically correct. Those separate tasks require different editorial rules and should remain explicit in your workflow.

Check assignment length

Confirm that a paragraph or short response meets a required sentence range before submission or grading.

Control content density

Measure product descriptions, landing-page sections, and support templates so teams can keep copy concise.

Add a publishing gate

Reject empty content and flag drafts whose sentence totals fall outside a CMS or editorial rule.

Which punctuation marks end a sentence?

Periods, question marks, and exclamation marks can end sentences. A consecutive run of terminal marks counts as one boundary.

Does the counter understand abbreviations?

It protects common titles, time and business abbreviations, initials, acronyms, and decimal numbers to avoid frequent false splits.

Does text need final punctuation?

No. A meaningful trailing fragment counts as a sentence even when its final period, question mark, or exclamation mark is omitted.

Why is empty text rejected instead of showing zero?

Because a missing submission is different from real prose with a measurable result. Empty text, or text with only spaces, gets a clear message instead of a count of zero that could pass for a valid answer.

What should I check in highly technical text?

Unusual shorthand from a specialized field may not be recognized, because no compact set of rules covers every abbreviation. For dense technical material, review the count, and keep normal spacing between sentences for the best results.

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-sentences

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-sentences \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Dr. Rivera arrived at 9 a.m. She reviewed the report. Was it complete? Yes!"}'
{
  "text": "Dr. Rivera arrived at 9 a.m. She reviewed the report. Was it complete? Yes!"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.count_sentences",
  "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.

It is useful for writers, editors, teachers, content teams, and developers who need a quick total or a stable API response.

How sentence boundaries are detected

That makes the result suitable for repeatable editorial checks, automated tests, classroom systems, and content pipelines: identical text produces the same sentence count every time, whether it is checked in the browser or sent through the API.

Using the result in writing and automation

Paste or send one non-empty text string and receive a JSON object containing sentence_count. A successful API item uses the published base price of $0.002; the on-page browser tool is intended for convenient interactive checks.

What happens when text is empty?

Empty and whitespace-only text fails with an invalid_input error so missing content is never confused with a valid zero.

How much does the API cost?

Each successful API item uses the published base price of $0.002. The browser tool is available for interactive checks.

Read the full KIT documentation →