Token count estimator — no key, all models
Need to know how many tokens your text will cost or whether it fits a context window — without pasting an API key into a random tool? This estimator uses locally-bundled tokenizer heuristics for every major model family and runs fully offline in your browser. No key, no upload, no network call.
How it works
Exact token counts require each provider’s tokenizer, but for English prose the relationship between characters and tokens is remarkably stable. The tool applies per-family calibration:
- OpenAI (GPT / o-series) — approximately 4 characters per token.
- Claude — very close to OpenAI, slightly different on punctuation and whitespace.
- Gemini — a touch more tokens on the same text due to its SentencePiece vocabulary.
- Llama — its own SentencePiece vocabulary, typically a few percent higher than GPT.
It blends a characters-per-token estimate with a words-per-token check so a wall of symbols or a list of short words doesn’t skew the result, then reports a token count for each selected family next to raw character and word counts.
How different text types affect token counts
The same number of characters produces different token counts depending on what the text contains. Understanding this helps you calibrate the estimate for your specific use case:
English prose — The most predictable case. Approximately 4 characters per token, with minimal variance between model families. This tool is most accurate here.
Code and structured data (JSON, CSV, XML) — Symbol-heavy and uses many short tokens for operators, brackets, and keywords. Tokenises less efficiently than prose — closer to 3 characters per token in dense code. The estimate may be conservative (low) for large code files.
Non-Latin scripts (Chinese, Japanese, Arabic, Cyrillic) — These often tokenise at 1–2 characters per token, so the same number of characters produces far more tokens than English. Run estimates on representative samples of your actual language mix.
Mixed content — A prompt that combines an English system instruction with a user’s Arabic or Korean message will tokenise at different rates per section. Budget separately for each language segment if accuracy matters.
URLs and identifiers — Long URLs, file paths, and identifiers often tokenise character-by-character and can cost many more tokens than their length suggests. A single long URL can easily consume 30–50 tokens.
Comparing the no-key estimate against the API count
For English prose, the no-key estimate is typically within 3–8% of the exact API-reported count. This is accurate enough for:
- Checking whether a document fits a context window (with a safety margin)
- Estimating API costs before a test run
- Comparing relative sizes of prompts
When you need billable-exact counts — for production cost accounting, tight context-window packing, or debugging a specific tokenizer — use the Token Count API Tester (BYO key) to get the provider’s actual count.
Tips for accurate budgeting
- Estimate in the same language you’ll use. Non-English and mixed scripts tokenise differently — re-check with representative text.
- Treat code separately. Source code and JSON tokenise less predictably than prose; add a margin.
- Add headroom for context limits. Leave room for the system prompt and the completion, not just the input you pasted.
- Confirm before billing. For an exact figure, use the provider’s own tokenizer; this tool is for fast, key-free planning.