Token estimator
Estimate how many LLM tokens a text uses, from its characters and words. An approximation, not an exact count.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/token-estimate \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"The quick brown fox jumps over the lazy dog."}}'
import json, urllib.request
body = {'input': {'text': 'The quick brown fox jumps over the lazy dog.'}}
request = urllib.request.Request("https://setget.net/v1/tools/token-estimate", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/token-estimate", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"The quick brown fox jumps over the lazy dog."}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "token-estimate",
"input": {
"text": "The quick brown fox jumps over the lazy dog."
}
}
{
"input": {
"text": "The quick brown fox jumps over the lazy dog."
}
}
Endpoint: POST /v1/tools/token-estimate. Over MCP: run_tool with slug: "token-estimate".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The text to estimate. |
Example
Input
{
"text": "The quick brown fox jumps over the lazy dog."
}Result
{
"tokens": 12,
"tokens_by_characters": 11,
"tokens_by_words": 12,
"characters": 44,
"words": 9,
"note": "Approximation: about 4 characters or 0.75 words per token. \"tokens\" is the mean of the two estimates."
}Questions
- How accurate is this?
- It is a rule of thumb: about 4 characters or 0.75 words per token for English prose. Real counts depend on the model and are often 10 to 30 per cent different.
- When is the estimate furthest off?
- For code, numbers, emoji and languages other than English, which usually need more tokens than this suggests. Use the model's own tokenizer when the exact number matters.
Related tools
- Word and character counterCount characters, words, lines, sentences, paragraphs and UTF-8 bytes in a text.
text-count - Text chunkerSplit long text into chunks of a maximum size for search and RAG pipelines, breaking at natural boundaries.
text-chunk - Truncate textShorten long text to a maximum length, cutting from the middle, start or end and marking the cut with an ellipsis.
truncate-middle - Apply a patchApply a unified diff to a text and get the patched result, with clear errors when a hunk does not fit.
patch-apply - Case converterConvert text between lower, UPPER, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case and more.
case-convert - Escape and unescape textEscape or unescape text for HTML, URLs, JSON strings, shell commands, regular expressions and CSV fields.
escape-unescape