Skip to content
KazamTools

LLM Token Counter

Exact OpenAI token counts and clearly labelled estimates for Claude, Gemini, Llama and more.

Characters
0
Words
0
Lines
0
Size (UTF-8)
0 B

Exact OpenAI counts use the official vocabularies. On first use your browser downloads them (about 1.4 MB) from the jsDelivr CDN; your text is never sent anywhere.

OpenAI tokenizers (exact)

OpenAI o200k_base

0

GPT-4o, GPT-4.1, GPT-5.x, o1, o3, o4-mini (GPT-6 models are assumed to use it too)

OpenAI cl100k_base

0

GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, text-embedding-3

Other models (estimates)

These companies do not publish browser tokenizers for their current models, so the numbers below are estimates with a likely range. The method for each is explained under the table.

TokenizerEstimateLikely rangeChars/token
Claude (Anthropic)Claude Opus 4.7 and later, Fable, Opus 5.x, Sonnet 5.x, Haiku 5.50
Gemini (Google)Gemini 2.5, 3.x and 4 models0
Llama 3 and later (Meta)Llama 3.x and Llama 4 models (128K-token tiktoken-style vocabulary)0
Mistral (Tekken)Current Mistral models (Large, Medium, Small, Codestral, Ministral)0
DeepSeekDeepSeek V4 models (deepseek-flash, deepseek-v4-pro)0
Grok (xAI)Grok 4.x and Grok Build models0
How each estimate is made
  • Claude (Anthropic): Anthropic says Claude 4.7 and later models produce about 30% more tokens than earlier Claude models for the same text. We treat earlier Claude counts as roughly equal to cl100k_base (an assumption, not an Anthropic figure). For an exact number use Anthropic’s free count_tokens API. Anthropic: token counting
  • Gemini (Google): Google says a Gemini token is about 4 characters and 100 tokens are about 60–80 English words, which matches o200k_base on English text. Use the Gemini countTokens API for an exact number. Google: understand and count tokens
  • Llama 3 and later (Meta): Llama 3 replaced SentencePiece with a 128K-token BPE vocabulary built in the tiktoken style, so English and code count close to cl100k_base, and other languages a little lower.
  • Mistral (Tekken): Mistral’s Tekken tokenizer is a tiktoken-style BPE vocabulary of about 131K tokens, between cl100k_base and o200k_base in size, so we use o200k_base plus 5%.
  • DeepSeek: DeepSeek’s own rule of thumb: 1 English character ≈ 0.3 tokens and 1 Chinese character ≈ 0.6 tokens. DeepSeek: token usage
  • Grok (xAI): xAI does not publish a tokenizer or a rule of thumb, so we use o200k_base plus 5% with a wide range.

How to use the LLM Token Counter

  1. 1Paste your prompt, document or code into the box, or click Load sample.
  2. 2Read the exact token counts for OpenAI’s o200k_base and cl100k_base tokenizers.
  3. 3Compare the estimates for Claude, Gemini, Llama, Mistral, DeepSeek and Grok, each with a likely range.
  4. 4Click Estimate the cost to price the prompt across models.

What a token is

Language models do not read letters or words. They read tokens: chunks of text from a fixed vocabulary. A common word like “Pakistan” is one token. A longer word is split, so “tokenization” becomes “token” + “ization”. Ten digits such as 1234567890 become 4 tokens, because the tokenizer groups digits in threes. Spaces usually ride along with the next word, and punctuation is often its own token.

You pay for tokens, rate limits are set in tokens, and context windows are measured in tokens. So when a prompt is “too long” or a bill looks high, the token count is the number that matters.

Exact counts and estimates

This page gives two kinds of numbers, and labels them clearly.

Exact (OpenAI). OpenAI publishes its vocabularies. The tool runs the open-source gpt-tokenizer library with the two current ones:

Tokenizer Vocabulary Used by
o200k_base about 200,000 tokens GPT-4o, GPT-4.1, GPT-5.x, o1, o3, o4-mini
cl100k_base about 100,000 tokens GPT-4, GPT-3.5 Turbo, text-embedding-3

OpenAI has not published a tokenizer for its newest GPT-6 models, so we assume they use o200k_base like GPT-5.

Estimates (everyone else). Anthropic, Google, xAI and Mistral do not ship browser tokenizers for their current models. Instead of hiding that, the tool starts from the exact OpenAI count and applies a documented factor, then shows a likely range:

estimate = exact OpenAI count × factor (range: low factor to high factor)
Model family Based on Factor Range Why
Claude 4.7 and later cl100k_base 1.30 1.10–1.55 Anthropic says the newer Claude tokenizer uses about 30% more tokens than before
Gemini o200k_base 1.00 0.85–1.20 Google: about 4 characters per token, 100 tokens ≈ 60–80 words
Llama 3 and later cl100k_base 1.00 0.80–1.10 128K-token tiktoken-style vocabulary
Mistral (Tekken) o200k_base 1.05 0.90–1.30 ~131K-token tiktoken-style vocabulary
Grok o200k_base 1.05 0.90–1.30 No public tokenizer or rule of thumb

DeepSeek is the exception: it publishes its own rule, 1 English character ≈ 0.3 tokens and 1 Chinese character ≈ 0.6 tokens, so the tool uses that rule directly.

The Claude factor rests on one assumption we cannot check: that older Claude models counted roughly like cl100k_base. If you need the exact number, Anthropic’s count_tokens endpoint is free to use, and the Gemini API has a countTokens method. Both need an API key.

Before the tokenizer loads

The OpenAI vocabularies are about 1.4 MB compressed. Your browser downloads them once from the jsDelivr CDN and caches them. Until they arrive, and if the download fails, the tool uses a fast built-in estimator. It splits the text the way OpenAI’s tokenizers do (letter runs, groups of up to three digits, runs of punctuation, whitespace) and prices each piece with constants for each script.

We fitted those constants against the real o200k_base and cl100k_base tokenizers on about 50,000 characters of mixed text: English prose, Markdown, TypeScript, Python, JSON, CSV and ten other languages. On that set the estimator was usually within about 8% for English and code and within about 20% for other languages. Once the real tokenizer is ready, every number switches to the exact count, and the label says so.

Worked examples

All counts below were made with the real tokenizers.

  1. An English paragraph of 450 characters and 77 words: 87 tokens in both o200k_base and cl100k_base. That is 5.2 characters per token, or 1.13 tokens per word, which is typical for plain English. Our Claude estimate for it is about 87 × 1.3 ≈ 113 tokens.
  2. The same idea in Hindi (239 characters): 71 tokens in o200k_base but 244 in cl100k_base. The newer vocabulary is more than three times as efficient for Devanagari script. Russian shows the same pattern: 70 tokens against 134.
  3. A small JSON object, {"sku": "TL-600", "comfort_c": -5, "price_usd": 249}, is 52 characters but 23 tokens. Quotes, braces, colons and short keys are expensive, at about 2.3 characters per token.

Tips for using fewer tokens

  • Cut repeated instructions. A long system prompt sent with every request is billed every time. Prompt caching makes repeated prefixes much cheaper; the AI API cost calculator shows how much.
  • Send clean text, not markup. HTML and PDF extraction noise waste tokens. Convert documents with document to Markdown first.
  • Minify JSON you send as data. Whitespace and indentation are tokens too; the JSON formatter can minify it.
  • Leave room for the answer. The prompt and the reply share the context window. Check the fit with the context window checker.

Privacy

Your text is counted on your device, inside your browser. The only thing downloaded is the public tokenizer vocabulary, and nothing you type is uploaded, logged or stored.

Cite this tool

Using this tool in an essay, report or article? Copy a ready-made reference. Check your teacher's or publisher's style guide for small differences.

APA
KazamTools. (2026, October 22). LLM token counter. Retrieved October 30, 2026, from https://kazamtools.com/developer/llm-token-counter/
MLA
"LLM Token Counter." KazamTools, 22 Oct. 2026, https://kazamtools.com/developer/llm-token-counter/. Accessed 30 Oct. 2026.
Chicago
KazamTools. "LLM Token Counter." Last modified October 22, 2026. Accessed October 30, 2026. https://kazamtools.com/developer/llm-token-counter/.
Plain link
LLM Token Counter (KazamTools): https://kazamtools.com/developer/llm-token-counter/
HTML link
<a href="https://kazamtools.com/developer/llm-token-counter/">LLM token counter</a> by KazamTools

Frequently asked questions

What is a token?

A token is a chunk of text that a language model reads as one unit: a whole common word, part of a rare word, a few digits or a punctuation mark. In English one token is about 4 characters or three quarters of a word.

Are the token counts exact?

The two OpenAI counts (o200k_base and cl100k_base) are exact, made with the real published vocabularies. Claude, Gemini, Llama, Mistral, DeepSeek and Grok counts are estimates, because those companies do not publish browser tokenizers for their current models. Each estimate shows a likely range.

Which tokenizer does GPT-5 use?

GPT-4o, GPT-4.1, GPT-5 and the o-series models use o200k_base. Older models such as GPT-4 and GPT-3.5 Turbo use cl100k_base. OpenAI has not published the tokenizer for its newest models, so we assume they use o200k_base too.

How do I get an exact Claude or Gemini token count?

Use the provider’s own counting endpoint: Anthropic’s count_tokens API is free to use, and Google’s Gemini API has a countTokens method. Both need an API key, so this page cannot call them for you.

Why does the same text use more tokens in other languages?

Tokenizer vocabularies are built mostly from English text, so English words are usually one token while words in Hindi, Arabic or Russian are split into many pieces. Newer vocabularies such as o200k_base are much better at other languages than older ones.

Is my text uploaded?

No. Counting happens in your browser. The first time you count, your browser downloads the OpenAI tokenizer files (about 1.4 MB) from the jsDelivr CDN; your text is never sent anywhere.

Was this tool helpful?