Token estimator

Estimate how many LLM tokens a text uses, from its characters and words. An approximation, not an exact count.

Input

The text to estimate.

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

NameTypeRequiredWhat 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.