Token Counter for GPT, Claude, Gemini and Llama

Count tokens exactly for OpenAI models, estimate them for Claude, Gemini and Llama, see the cost, and watch the text split into tokens.

Loading tokenizers (about 3 MB, once)...
GPT tokens (o200k)
...
exact
GPT-4 tokens (cl100k)
...
exact
Characters
326
356 bytes UTF-8
Words
48

Tokens by model family

TokenizerTokensType
OpenAI o200k_base
GPT-4o, GPT-4.1, GPT-5.x, o-series, gpt-oss (GPT-6 assumed)
...Exact
OpenAI cl100k_base
GPT-4, GPT-3.5 Turbo, text-embedding-3
...Exact
Claude (Opus 4.7 and later)
Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5, Opus/Sonnet 5, Opus 4.7+
...Estimate
Claude (Sonnet 4.6 and earlier)
Claude Sonnet 4.6, Haiku 4.5 and earlier
...Estimate
Gemini / Gemma
Gemini 2.5 to 4, Gemma
...Estimate
Llama 3
Llama 3.x
...Estimate
Mistral (Tekken)
Mistral Large/Medium/Small, Codestral
...Estimate
DeepSeek
DeepSeek V3/V4, R1
...Estimate
Qwen
Qwen 2.5 / 3 / 3.5
...Estimate
Grok
Grok 4.x
...Estimate

Only OpenAI publishes its tokenizers in a form a browser can run. The others are estimated from the exact counts (hover a row for the method). For an exact Claude or Gemini count, use the provider's free token-counting API endpoint.

Cost of this text

As input
...
$2/1M tokens
As output
...
$10/1M tokens

β‰ˆ 0 tokens (estimate, Claude (Opus 4.7 and later)) Β· <0.1% of the 1,000,000-token context window

Anthropic list price, as of 2026-10-16. Source. For whole workloads, use the LLM API cost calculator.

Token visualiser

...

Each colour is one token (hover for its ID). A block holding several IDs is one character split across tokens, common for emoji and CJK text.

Tokenized entirely in your browser with the open-source tiktoken rank files. Your text is never sent anywhere. Browse all free tools.

Found a problem, or something that could be better? We read every message and we fix things quickly.

This token counter shows how many tokens your text uses in GPT, Claude, Gemini, Llama and other large language models, because API prices, context windows and rate limits are all measured in tokens, not words. Paste a prompt or a whole document and you get the exact count for OpenAI's two current tokenizers, o200k_base (GPT-4o, GPT-4.1, GPT-5.x) and cl100k_base (GPT-4, GPT-3.5 Turbo), plus what that text costs as input or output at the model you pick.

Counts for other model families are estimates, and the tool says so on every row. Anthropic, Google and xAI do not publish their tokenizers in a form a web page can run, so their figures are derived from the exact OpenAI counts using the providers' own published ratios. The visualiser colours each token so you can see why emoji, code and non-English text cost more than plain English. Everything runs locally: the tokenizer files load into your browser once and your text never leaves it.

How to use

  1. Paste or type your text. Counts update as you type, with a short delay for very long documents.
  2. Read the exact GPT counts at the top, then the per-family table. Rows marked Estimate are approximations; hover a row to see how it was calculated.
  3. Pick a model to see the cost of the text as input and as output, and how much of its context window it fills.
  4. Scroll to the token visualiser and switch between o200k_base and cl100k_base to compare how they split the same text. Turn on Token IDs to see the numbers the model receives.
  5. Use Copy counts to paste a summary into a ticket or spreadsheet.

Frequently asked questions

How many tokens is a word?

For ordinary English prose, about 1.3 tokens per word with OpenAI's o200k_base tokenizer, or roughly 4 characters per token. Common short words are one token each; long or rare words split into several. Code, numbers, URLs and most non-English languages use more tokens per word. The tool shows your text's actual tokens-per-word ratio under the word count.

Is the Claude token count exact?

No, and it is labelled as an estimate. Anthropic's tokenizer is not public. Anthropic states that the tokenizer introduced with Claude Opus 4.7 (used by Claude Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5) produces about 30% more tokens than the previous one, and that 1M tokens holds about 555,000 English words versus 750,000 before. The estimate applies that ratio to the exact cl100k_base count. For an exact number, call Anthropic's free token-counting endpoint (POST /v1/messages/count_tokens) with your text.

Why do emoji and Chinese or Japanese text use so many tokens?

Modern tokenizers work on UTF-8 bytes. Frequent byte sequences, mostly English words and common code, get their own token; anything rarer is split into smaller pieces, down to single bytes. Most emoji are 4 bytes and take 1 to 3 tokens, and a skin-tone or gender modifier adds more. o200k_base has many more tokens for non-English scripts than cl100k_base, so the same Chinese or Hindi sentence is noticeably cheaper on GPT-4o and later than on GPT-4. The visualiser shows these splits as blocks that hold several token IDs.

What is the difference between o200k_base and cl100k_base?

They are OpenAI's two current tokenizers. cl100k_base has about 100,000 tokens and is used by GPT-4, GPT-3.5 Turbo and the text-embedding-3 models. o200k_base has about 200,000 tokens and is used by GPT-4o, GPT-4.1, GPT-5.x and the o-series reasoning models; gpt-oss uses a variant of it. The larger vocabulary mainly helps non-English text and code, where it typically produces fewer tokens.

Does the API count more tokens than this tool shows?

Usually a few more per request. Chat APIs wrap each message in role markers that add a handful of tokens, and the system prompt, tool definitions, earlier conversation turns and any reasoning tokens are billed too. Images, audio and files are priced separately. This tool counts the raw text you paste, which is the part you control.

Is my text sent to a server?

No. The tokenizer rank files are downloaded to your browser once (about 3 MB) and all counting happens on your device. You can disconnect from the internet after the page loads and the counter keeps working.

Why the same text has different token counts in different models

Every model family trains its own tokenizer: a fixed vocabulary of text fragments, learned from the data the model was trained on. A word that is one token in one vocabulary can be three in another. The differences are small for plain English and large for code, rare languages, emoji and long numbers.

Vocabulary size is the main lever. GPT-4's cl100k_base has about 100,000 entries; GPT-4o and later use o200k_base with about 200,000; Gemini's SentencePiece vocabulary has about 256,000; Llama 3 uses a 128,000-entry vocabulary built on cl100k. A larger vocabulary usually means fewer tokens per sentence, especially outside English, but providers also change tokenizers for quality reasons. Anthropic's newer tokenizer produces more tokens than its old one, not fewer.

This matters for cost comparisons. If two models charge the same price per million tokens but one needs 30% more tokens for your text, it is 30% more expensive for you. The LLM API cost calculator on this site can scale counts per tokenizer for exactly that reason.

How each estimate is made

β€’ OpenAI o200k_base and cl100k_base: exact, using the same rank files as OpenAI's tiktoken library. OpenAI has not published a tokenizer for GPT-6; o200k_base is the closest public match and is shown as such.

β€’ Claude (Opus 4.7 and later, including Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5): cl100k_base count multiplied by 1.35, from Anthropic's statements that the new tokenizer yields about 30% more tokens and fits about 555,000 English words in 1M tokens versus 750,000 before.

β€’ Claude Sonnet 4.6, Haiku 4.5 and earlier: the cl100k_base count. Anthropic's older tokenizer lands close to it for English prose.

β€’ Gemini and Gemma: the o200k_base count. Google quotes about 4 characters per token for English, in line with o200k_base.

β€’ Llama 3: the cl100k_base count, since Llama 3's vocabulary contains cl100k's plus 28,000 additional tokens mostly for other languages.

β€’ Mistral, DeepSeek, Qwen and Grok: the o200k_base count, as all use large byte-level BPE vocabularies of a similar size. For English, expect these estimates to be within about 10 to 15% of the real count; for code and non-English text the error can be larger.

Practical ways to spend fewer tokens

Minify JSON before sending it. Indentation and newlines are tokens too, and pretty-printed JSON can use a third more tokens than the same data on one line; the JSON formatter on this site minifies in one click. Field names repeat on every record, so for large tables CSV is often cheaper than JSON.

Put stable instructions first and the changing part last. Providers cache repeated prompt prefixes and bill cache hits at a fraction of the input price (10% or less of the normal input rate on current OpenAI, Anthropic and Google models), but only if the beginning of the prompt is identical between requests.

Trim conversation history. A chat app resends the whole conversation on every turn, so a 20-message thread costs far more than 20 separate questions. Summarise or drop old turns once they stop mattering.

Remove personal data you do not need the model to see. It costs tokens and creates risk; the PII redactor on this site swaps it for short placeholders and restores it in the reply.

Related free tools

  • LLM API Cost Calculator β€” Compare the cost of your workload across 40+ models, with caching, batch discounts, long-context tiers and reasoning tokens. Prices sourced and dated.
  • Word Counter β€” Count words, characters, sentences and reading time, and check X, LinkedIn, Instagram, YouTube, SEO and SMS limits as you type.
  • PII Redactor for AI Prompts β€” Replace emails, phone numbers, card numbers, API keys and names with placeholders before you paste text into an AI, then restore them in the reply.
  • JSON Formatter β€” Pretty-print, minify and validate JSON, with parse errors located by line and column. In your browser, no upload.
  • LLM VRAM Calculator β€” Work out how much GPU memory a local LLM needs for your quantization and context length, whether it fits your GPU or Mac, and how fast it will run.