How the LLM Token Counter Works
This tool allows you to paste large documents or codebases and instantly get an estimate of how many tokens they will consume before you send them to an API, helping you manage costs and stay within context limits.
OpenAI (Exact Count)
For OpenAI models like GPT-5 and o1, we use the exact o200k_base tokenization algorithm running locally in your browser. The token count shown here will perfectly match what OpenAI bills you for.
Claude & Gemini (Estimations)
Anthropic and Google use proprietary, server-side tokenizers that vary slightly between model versions. Because there is no official lightweight client-side library for these models, we use industry-standard heuristics:
- Claude: Newer models like Claude 4.5 and 4.7 use updated tokenizers that are slightly less efficient than older models. We estimate using 3.0 characters per token. Keep in mind that code and JSON are more "token-dense" than standard English prose.
- Gemini: Google's standard rule of thumb for Gemini 3.5 is that 1 token is approximately 4 characters of English text.
Privacy Guarantee
This entire tool runs strictly in your browser using JavaScript. Your text is never uploaded, saved, or sent to any server. It is completely safe to paste confidential code or private documents here.