AI Token Counter
Count tokens for GPT-5, GPT-4o, Llama, Qwen, DeepSeek, Mistral, Gemma, Gemini and Claude using real tokenizers that run privately in your browser.
π Runs entirely in your browser β nothing is uploadedWhat a token is and why it matters
Large language models do not read characters or words. They read tokens: pieces of text from a fixed vocabulary, often a whole short word, part of a longer word, a space plus a word, or a single punctuation mark. API prices, rate limits and context windows are all measured in tokens, so knowing the token count of a prompt tells you what it will cost, whether it fits in the model's context and how much room is left for the answer. As a rule of thumb, one token is about four characters of English text, but the real number depends on the language, the content and the model.
This counter uses the real tokenizers published by OpenAI, Meta, Alibaba (Qwen), DeepSeek, Mistral and Google (Gemma). For those models the count is exact. Tokenization runs locally with transformers.js, so confidential prompts, source code and documents stay on your device.
Exact counts and estimates
OpenAI's o200k_base encoding is used by GPT-5, GPT-4.1, GPT-4o and the o-series models, while
the older cl100k_base covers GPT-4, GPT-3.5 Turbo and the text-embedding-3 models. Open-weight
models ship their tokenizer with the model, so those counts are exact too. Anthropic and Google do not
publish the tokenizers of current Claude and Gemini models. For them the tool uses the closest public
tokenizer and marks the number as an estimate, which is good for budgeting but can be off by several
percent.
Always the latest tokenizer
Tokenizers are not bundled into this page. When you pick a model, the tool checks Hugging Face for the most recent version of that tokenizer and downloads it only if it changed, so fixes published upstream are used automatically. The repository and version are shown below the text box. Tips for saving tokens: remove repeated boilerplate, prefer plain text over heavy markup, and keep in mind that non-Latin scripts and emoji usually need more tokens per character.
How to use
- Pick a modelChoose the model family you are writing for, such as GPT-4o, Llama 3, Qwen or Claude.
- Paste your textPaste a prompt, document or code. The count updates as you type.
- Read the countsSee tokens, characters, words and characters per token, and check whether the count is exact or an estimate.
- Inspect the tokensTurn on Show tokens to see exactly how the text is split, which helps you trim long prompts.