AI token counter
Language models read text as tokens, not words, and API prices, rate limits and context windows are all measured in tokens. Paste a prompt, a document or code and this counter tokenizes it with the same byte-pair encodings OpenAI publishes, o200k_base for GPT-4o and later models and cl100k_base for GPT-4 and GPT-3.5, so the count is exact for those encodings. You can colour the text by token to see how it is split, check how much of a context window it fills and get a character-based estimate for models whose tokenizers are not public.
- Tokens (exact)
- Loading tokenizer…
- Estimate for other models
- 0
- Characters
- 0
- Words
- 0
Exact for the selected OpenAI encoding. For other models only an estimate is shown.
How to use the AI Token Counter
- 1
Paste your text
A prompt, a chat history, a document or source code.
- 2
Pick the encoding
o200k_base for newer OpenAI models, cl100k_base for GPT-4 and GPT-3.5.
- 3
Read the counts
Exact tokens, an estimate for other models, characters, words and context use.
Exact counts and estimates
Exact counts come from the published BPE vocabularies (via the open-source js-tiktoken library). Other providers do not publish their tokenizers, so the estimate uses the larger of characters ÷ 4 and words ÷ 0.75, a common rule of thumb for English. Non-English text, code and emoji usually take more tokens per word.
- Estimate = max(characters / 4, words / 0.75)
When to use it
- Check that a prompt fits a model’s context window.
- Estimate API cost before sending a large document.
- See why some languages and emoji use more tokens.
Limits
- Exact only for OpenAI’s o200k_base and cl100k_base encodings; newer models may use other encodings.
- Chat APIs add a few tokens per message for roles and formatting.
Privacy
Tokenization runs in your browser. Your text is never uploaded.
Frequently asked questions
What is a token?
A piece of text the model treats as one unit: often a word, part of a word, a space plus a word, a punctuation mark or a few bytes of a rare character. In English, 1,000 tokens is roughly 750 words.
Are Claude or Gemini counts exact here?
No. Their tokenizers are not published, so only an estimate is shown. Their APIs have token-counting endpoints if you need exact numbers.
Why does Sinhala or Tamil text use so many tokens?
Tokenizers are trained mostly on English, so other scripts are split into smaller pieces, sometimes single bytes. The token view shows this clearly.
Why load data on first use?
The tokenizer vocabularies are a few megabytes, so they are downloaded only when you open this page, then cached by your browser.
Do spaces and new lines count?
Yes. Whitespace is part of tokens, which is why the same words with different spacing can give different counts.
Is my text sent to OpenAI?
No. Everything happens in your browser; nothing is sent to any API.
Related tools
People also use
- JWT Generator & SignerCreate and sign JSON Web Tokens with HMAC, RSA or ECDSA keys, entirely in your browser.
- Base64 Encoder & DecoderEncode and decode Base64 and Base64url, text or files.
- URL Encoder & DecoderPercent-encode or decode URLs and see their query parameters.
- CSV to JSON ConverterConvert CSV ⇄ JSON with correct quoting, types and nested data.
Last updated November 24, 2026 · How we build and test our tools