Token Counter — Count GPT-4o & GPT-4 Tokens Accurately (Free)
Token visualization
Colors identify adjacent tokens (no semantic meaning)Enter text above to see token visualization.
Related external tools
Some links are affiliate links.
Related tools
This free token counter uses a real tokenizer (OpenAI BPE) to accurately count the tokens in your prompt or text for GPT-4o, GPT-4 and GPT-3.5. Paste any text to see the exact token count, a color-coded visualization of how the text is split into tokens, plus character and word counts — all in real time. Switch between models (GPT-4o = o200k_base, GPT-4 = cl100k_base) to compare token counts. Everything runs in your browser. Your text is never sent to a server — the tokenizer data is bundled with the page.
How to use
- Select a model (GPT-4o, GPT-4, GPT-3.5) — this sets the tokenizer encoding.
- Paste or type your prompt in the text area. Token count and character count update in real time.
- The color-coded visualization below shows how your text splits into tokens. Each chip is one token. Spaces appear as · and newlines as ↵.
- Use 'Clear' to reset, or 'Copy' to copy your text.
- Optionally expand 'Cost estimate' to calculate an approximate API cost by entering the price per 1 000 tokens.
- No install, no sign-up — your text is never uploaded. The tokenizer runs entirely in your browser.
What is a token?
A token is the basic unit that LLMs like GPT use to process text. Words are split into subword pieces, so a single word may be one token or several. In English, one token is roughly 4 characters or 0.75 words on average — but this is only a rough guide. The actual count depends on the specific text, language and tokenizer encoding. This tool uses the real tokenizer so you get the exact count, not an estimate.
Model encodings: cl100k_base and o200k_base
Different GPT models use different tokenizer encodings. GPT-4 and GPT-3.5 use cl100k_base, while GPT-4o and GPT-4o mini use the newer o200k_base, which is more efficient for multilingual text. The same text can have a different token count depending on which encoding is used — use the model selector to compare. Note: this tool covers OpenAI GPT models only. Claude, Gemini and other models use different tokenizers, so their token counts will differ from what you see here.
Reading the token visualization
Each colored chip in the visualization represents exactly one token. Adjacent tokens alternate colors so you can tell where one ends and the next begins. Spaces inside a token are shown as the middle dot · and newlines as ↵ — this makes it easy to see how whitespace is tokenized. If your text produces more than 2 000 tokens, only the first 2 000 chips are drawn, but the total count shown is always accurate.
Characters, words and tokens
Character count is the number of Unicode code points (emoji and CJK characters each count as one). Word count is the number of runs of letters or digits — this is only meaningful for space-separated languages. Token count is different from both: it is the actual number of BPE tokens the LLM sees and what determines API cost and context-window usage.
Use cases
Prompt management and context-window limits
Paste your full prompt to check whether it fits within the model's context window (for example 128 000 tokens for GPT-4o). If you are close to the limit, trim your prompt until the count is comfortably below it.
Estimating API costs
API cost is charged per token. Enter your text, note the token count, and multiply by the input token price to get a rough cost estimate. Expand the 'Cost estimate' panel and enter the price per 1 000 tokens. Note that the actual price depends on the model, whether tokens are input or output, and the current OpenAI pricing — always check the official pricing page for the latest rates.
Comparing token efficiency across languages
The same meaning expressed in Japanese, Chinese or Korean typically uses more tokens than in English, because non-Latin scripts are encoded less compactly by BPE. GPT-4o's o200k_base encoding improves multilingual efficiency compared to cl100k_base — try switching models to compare the difference for your text.
Frequently asked questions
- Is the token count accurate?
- Yes, for the supported models. This tool uses the same real tokenizer (BPE) that OpenAI's GPT-4o, GPT-4 and GPT-3.5 models use internally, so the count matches what the API charges. It is not an approximation like 'characters divided by 4'.
- Why does the token count change when I switch models?
- GPT-4o and GPT-4o mini use the o200k_base encoding, while GPT-4 and GPT-3.5 use cl100k_base. These encodings have different vocabularies, so the same text is split differently and can produce a different number of tokens.
- Can I count tokens for Claude or Gemini?
- No. This tool only supports OpenAI GPT models (GPT-4o, GPT-4, GPT-3.5). Claude, Gemini and other models use their own proprietary tokenizers, so the token counts here do not apply to them.
- Is my text sent to a server?
- No. The tokenizer library is bundled with the page and runs entirely in your browser. Your text never leaves your device — nothing is uploaded or stored.
- Why do Japanese, Chinese and Korean text use more tokens?
- BPE tokenizers split text into subword pieces. Scripts that use Latin characters are encoded more compactly, while CJK characters often map to more tokens per character. The newer o200k_base (GPT-4o) encoding improves this somewhat compared to cl100k_base — you can compare by switching models.
- Can I estimate my API cost here?
- You can get a rough estimate. Expand the 'Cost estimate' section and enter the input token price in dollars per 1 000 tokens. The tool multiplies the token count by that price. This is an approximation — actual costs depend on whether tokens are input or output, the exact model version and current OpenAI pricing. Always verify on the official pricing page.
- Do I need an API key?
- No. The tokenizer runs entirely in your browser using the bundled tokenizer data. No OpenAI API calls are made.