← All Tools

🧮 Token Counter

Estimate tokens, words, characters, context-window fit, and rough LLM prompt costs for GPT, Claude, Gemini, and Llama-style prompts.

Model comparison

Compare token estimates, context-window percentage, and input/output/cached-input pricing across model families. Prices are examples; confirm current provider rates before budgeting.

Counts are estimates, not tokenizer-perfect. Code, JSON, CJK text, emojis, and whitespace-heavy prompts can differ by model tokenizer. Use this for planning budgets and context fit, then confirm with provider usage reports for billing.

Runs in your browser

Prompt text is counted locally in your browser. Share links include settings by default; include prompt text only if you explicitly check the box.

What this tool does

Token Counter estimates how many model tokens are in pasted text so prompts, documents, and chat messages can fit into context windows.

Why it is useful

Token estimates help control LLM cost, avoid context overflows, and compare prompt sizes before sending content to an AI provider.

How it works

The tool estimates token count from text patterns in the browser. It is intended for planning and may differ from a provider-specific tokenizer.

Best input

Paste the exact prompt, transcript, document excerpt, or system message you plan to send. Include formatting if it will be sent to the model.

Privacy note

Counting happens locally in your browser.

Important limitation

Different AI providers and models tokenize text differently. Treat this as an estimate unless the page explicitly uses the target model tokenizer.

Quick answers

Why does my API bill show a different number?

Providers count tokens with model-specific tokenizers and may include hidden/system/tool messages.

Can this reduce cost?

It helps you spot oversized prompts before sending them, which can reduce avoidable token usage.

API examples

Call the same deterministic core through Utilito’s compact API router. Send only data you intentionally submit to the server-side endpoint.

Try in API playground →Schema →
Estimate tokens with curl
curl
curl -X POST https://utilito.dev/api/run \
  -H "Content-Type: application/json" \
  -d '{"tool_id":"token-counter","input":{"text":"You are a careful coding agent. Verify changes before reporting.","model":"gpt-4o","outputTokens":1000,"requestsPerDay":25}}'
Estimate tokens from JavaScript
javascript
const res = await fetch('https://utilito.dev/api/run', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    tool_id: 'token-counter',
    input: { text: 'You are a careful coding agent. Verify changes before reporting.', model: 'gpt-4o', outputTokens: 1000, requestsPerDay: 25 }
  })
});
const data = await res.json();
console.log(data.result.output || data.result.report);
Estimate tokens from Python
python
import requests
payload = {
    "tool_id": "token-counter",
    "input": {"text": "You are a careful coding agent. Verify changes before reporting.", "model": "gpt-4o", "outputTokens": 1000, "requestsPerDay": 25},
}
result = requests.post("https://utilito.dev/api/run", json=payload).json()["result"]
print(result.get("output") or result.get("report"))

Common Use Cases

Check if a prompt fits a model context window

Estimate prompt size plus reserved answer space before sending long agent instructions, documents, or transcripts.

Estimate daily API spend

Combine approximate input/output tokens with request volume to understand cost before a batch run.

Trim oversized prompts

Find character, word, line, and token counts before moving content into a context optimizer.

LLM Token Toolkit workflow

Move from prompt counting to cost estimation, context-window budgeting, and log trimming before spending LLM tokens.

💸Prompt Cost Calculator🪟Context Window Calculator🧹Log Context Trimmer🧰Context Workbench🩹JSON Repair🎯JSON Query
View all in AI →