Skip to content

AI Token Counter

Paste text to count tokens. The OpenAI count is exact: it runs OpenAI's own o200k_base tokenizer in your browser. Claude, Gemini, Mistral and Llama use other tokenizers, so for them you get a clearly labelled estimate and the official way to get the exact number.

Your text never leaves your browser — nothing is sent to a server.

Your Text

0 chars0 words0 lines

Token Count by Model

OpenAI (GPT-4o, GPT-4.1, GPT-5, o-series) estimate
tiktoken o200k_base — loading, showing estimate
0
tokens
Gemini estimate
characters ÷ 4 (Google rule of thumb) · exact via countTokens
0
tokens
Claude estimate
ballpark from o200k · exact via count_tokens API
0
tokens
Mistral estimate
ballpark from o200k · exact via mistral-common
0
tokens
Llama 3 estimate
ballpark from o200k · exact via the model's tokenizer
0
tokens
How to read this: only the OpenAI row is an exact count. Anthropic, Mistral and Meta don't ship a tokenizer that runs in the browser for their current models, so those rows reuse the o200k count as a ballpark — the real number can be noticeably higher or lower, especially for non-English text. For an exact figure use the vendor tools listed below.

What is a token?

Language models don't read characters or words. A tokenizer first splits text into tokens — frequent words become one token, rarer words are split into pieces, and punctuation, digits and spaces get tokens of their own. Prices, rate limits and context windows are all measured in tokens.

A few words run through OpenAI's o200k_base tokenizer (counted with the same code this page uses):

  • "Hello" → 1 token
  • "calculator" → 1 token
  • "tokenization" → 2 tokens
  • "ChatGPT" → 2 tokens
  • "1000" → 2 tokens

Every model family has its own tokenizer

FamilyTokenizerOn this pageExact count
OpenAI GPT-4o, GPT-4.1, GPT-5, o-serieso200k_base (tiktoken BPE)Exacttiktoken library
OpenAI GPT-4, GPT-3.5 Turbocl100k_base (tiktoken BPE)Close estimatetiktoken library
Anthropic ClaudeAnthropic's own; not published. Claude Opus 4.7 and later use a newer tokenizer that yields about 30% more tokens than earlier Claude modelsBallparkcount_tokens API (free)
Google GeminiGoogle's own; about 4 characters per token by Google's rule of thumbEstimate (characters ÷ 4)countTokens API
MistralTekken (based on tiktoken) or SentencePiece in older versionsBallparkmistral-common library
Meta Llama 3128K-token vocabularyBallparktokenizer shipped with the model weights

Model-to-encoding mapping for OpenAI follows tiktoken's own model table. Newer OpenAI models not yet in that table are assumed to use o200k_base.

Rules of thumb — and where they break

OpenAI's tiktoken documentation says a token is "about 4 bytes" on average; Google says a Gemini token is "about 4 characters" and that 100 tokens are "about 60–80 English words". Those averages hold for typical English prose. They drift as soon as the text changes. We measured one sentence with the same meaning in three languages, plus a line of code, using o200k_base:

SampleCharactersTokensCharacters per tokenTokens per word
English sentence121186.71.1
Same sentence in German126245.31.7
Same sentence in Polish121353.52.1
One line of JavaScript87283.1—

The Polish sentence has the same length in characters as the English one but needs almost twice as many tokens, so it costs almost twice as much to process. One sentence is not a benchmark — paste your own text above to see your real ratio — but the direction is typical: languages with long, inflected words and code full of symbols use more tokens per character than plain English.

How to get the exact count from each vendor

  • OpenAI: the open-source tiktoken library — tiktoken.encoding_for_model("gpt-4o") returns the right encoding, and len(enc.encode(text)) is the count. This page uses the JavaScript port of the same tokenizer.
  • Anthropic Claude: the POST /v1/messages/count_tokens endpoint accepts the same input as a real request (system prompt, tools, images, PDFs) and returns input_tokens. It is free but rate-limited, and Anthropic calls the result an estimate that can differ slightly from billing. Count against the exact model you will use — the tokenizer changed with Claude Opus 4.7.
  • Google Gemini: the countTokens method returns the input token count before you send a request. Images, audio and video have their own rates — for example, Google lists audio at 32 tokens per second.
  • Mistral: the mistral-common library implements Mistral's tokenizers, including the tiktoken-based Tekken.
  • Llama: use the tokenizer distributed with the model weights you run.

Frequently asked questions

Is this token counter exact?

For OpenAI models that use the o200k_base encoding (GPT-4o, GPT-4.1, GPT-5 and the o-series), yes: the page runs the same tokenizer in your browser. For Claude, Gemini, Mistral and Llama it shows an estimate, because those vendors do not ship a browser tokenizer for their current models. Use their official tools for an exact number.

How many tokens is 1,000 words?

For typical English prose roughly 1,300–1,700 tokens: Google puts 100 tokens at about 60–80 English words. Other languages and code need more — in our measured example the same sentence took about 1.1 tokens per word in English and 2.1 in Polish. Paste your own text above for a real count.

Why do Claude, Gemini and GPT give different counts for the same text?

Each family uses its own vocabulary. OpenAI uses tiktoken encodings, Mistral uses Tekken (based on tiktoken) or SentencePiece, Llama 3 has a 128K-token vocabulary, and Anthropic and Google use their own tokenizers. Anthropic notes that Claude Opus 4.7 and later produce about 30% more tokens for the same text than earlier Claude models.

How do I count Claude tokens exactly?

Call Anthropic's free count_tokens endpoint (POST /v1/messages/count_tokens) with the same model, system prompt, messages and tools you plan to send. It returns input_tokens. It is rate-limited and Anthropic describes the result as an estimate that can differ slightly from billing.

Does code use more tokens than English text?

Usually yes per character. Our one-line JavaScript example came to about 3.1 characters per token, against 6.7 for an English sentence, because brackets, operators and identifiers split into many small tokens. Comments written in English tokenize like prose.

How do I reduce token usage?

Shorten system prompts, remove repeated instructions, summarise long conversation history instead of resending it, use compact JSON keys for structured data, and use prompt caching where the provider supports it for repeated context.

Sources (checked October 2026)

OpenAI tiktoken — github.com/openai/tiktoken (encodings, model table, "about 4 bytes" per token)

Anthropic token counting — platform.claude.com/docs/en/build-with-claude/token-counting

Google Gemini tokens — ai.google.dev/gemini-api/docs/tokens

Mistral tokenization — docs.mistral.ai/guides/tokenization and github.com/mistralai/mistral-common

Meta Llama 3 announcement — ai.meta.com/blog/meta-llama-3 (128K-token vocabulary)

Token Count

0
tokens
0
Characters
0
Words
Context window usage
0 used0.0% of 1.05M

Cost Estimate

As input (prompt)$0.00
As output (completion)$0.00
Pricing$2/1M in · $10/1M out
At scale (as input)
100 requests/day$0.00/mo
1,000 requests/day$0.00/mo
10,000 requests/day$0.00/mo