Find the longest word in text
Paste any text and get its longest word with the letter count: in the sample, constellation wins with 13 letters and both of its appearances come back, in order. Punctuation never adds length, and accented letters count like any other. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Paste a sentence, paragraph, article, or compact data sample to identify its longest word without counting surrounding punctuation. The result gives the maximum letter count and every word occurrence tied at that length, in the same order in which it appeared. The algorithm recognizes Unicode letters, so it works consistently with accented Latin text and many other writing systems. It is deterministic, requires no dictionary, and runs without a network request in the browser version.
How the longest word is identified
The finder scans the supplied text from beginning to end and treats each uninterrupted sequence of Unicode letters as a word. It counts the letters in every sequence, remembers the greatest count seen, and returns all occurrences that reach that count. Preserving source order makes the answer predictable when several candidates tie.
Repeated occurrences are also preserved because they represent separate positions in the text rather than a set of spellings. Capitalization is not changed, so Example and example remain distinguishable in the returned array even when their lengths are equal. This simple contract is useful in both interactive checks and automated pipelines because no locale-sensitive sorting, dictionary lookup, or statistical guess can change the result between executions.
What ignoring punctuation means
Punctuation does not add to a word's letter count. Commas, periods, quotation marks, parentheses, dashes, apostrophes, slashes, symbols, and digits act as boundaries between letter sequences. For example, a word followed by a comma is returned without the comma, while a hyphenated expression is evaluated as the separate letter sequences on either side of its hyphen.
This rule avoids inflating the result with formatting characters and makes the behavior explicit instead of depending on whitespace alone. The matcher uses Unicode letter categories rather than an English-only A-to-Z pattern, allowing letters with accents and letters from many scripts to participate naturally. Combining marks may stay attached to the letter sequence, but only actual Unicode letters contribute to length.
Emoji, standalone numbers, currency signs, and punctuation-only input are not words.
Using the result in editing and automation
Use this capability when the answer must be structured and reproducible rather than highlighted manually in an editor. A content workflow can flag unusually long terms before publication, a classroom exercise can compare vocabulary across passages, and a quality-control script can inspect labels or interface copy for words that may cause narrow-layout problems. Because every tie is returned, downstream code does not silently discard an equally long candidate.
The operation is a pure text parse: it sends no request to a dictionary, language model, or third-party service, and it does not attempt stemming, syllable counting, semantic interpretation, or grammatical tokenization. That makes it fast and transparent, but it also means the stated punctuation boundary rule is the authority.
What you can do with it
Check editorial vocabulary
Identify the longest terms in drafts and review whether specialized words need an explanation or a shorter alternative.
Test compact interface copy
Find words most likely to strain narrow buttons, cards, labels, or mobile layouts before visual testing.
Build language exercises
Generate a deterministic answer key that includes every tied longest word in the order students encountered it.
FAQ
Does punctuation count toward word length?
No. Punctuation separates letter sequences and is excluded from both the returned words and their letter counts.
Are repeated tied words included?
Yes. Each tied occurrence is preserved, even when the same spelling appears more than once.
Does it support accented and non-English letters?
Yes. Word detection uses Unicode letter categories rather than an ASCII-only alphabet.
How are hyphenated words and contractions measured?
Hyphens and apostrophes act as boundaries, like the rest of the punctuation. A hyphenated expression is measured as the separate runs of letters on each side, so it never wins just because two words were joined.
What happens if my text has no letters at all?
Numbers, emoji, currency signs and punctuation are not words, so a text made only of them has no longest word. The tool tells you so instead of presenting an empty result as the winner.
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/text/longest-word-find \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Small sparks illuminate distant mountains."}'const res = await fetch("https://api.kit.forhosting.com/text/longest-word-find", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Small sparks illuminate distant mountains."
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/text/longest-word-find",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Small sparks illuminate distant mountains."
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/text/longest-word-find", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Small sparks illuminate distant mountains."}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Small sparks illuminate distant mountains."}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/text/longest-word-find", 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": "Small sparks illuminate distant mountains."
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "text.longest_word_find",
"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.
Limits
max_tokens | 20000 |
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
How the longest word is identified
The output contains two fields: longest_words is an array preserving the words exactly as they appeared and length is the shared number of letters.
What ignoring punctuation means
If the entire text contains none of the recognized letter sequences, the capability returns a typed invalid_input error instead of claiming that an empty token is the longest word.
Using the result in editing and automation
Read length when only the maximum size matters, or iterate over longest_words when the spellings themselves matter. For large collections, call the API once per text item and store both output fields so later reviewers can understand the measured value without rerunning the original content.
Technical questions
What does the result contain?
It returns longest_words, an array of every tied occurrence in source order, and length, the number of Unicode letters in each returned word.
What happens if the text has no words?
The request fails with an invalid_input error because numbers, emoji, whitespace, and punctuation alone do not form a word.
How much does an API request cost?
The published base price is $0.002 per request. The browser version runs locally at no charge.