Skip to content

AI Token Counter

Paste a prompt or a document to count its tokens exactly with OpenAI's o200k_base and cl100k_base tokenizers, see estimates for Claude, Gemini, DeepSeek and Mistral from each provider's published ratio, and look at every token. Counting runs in your browser; the text is never sent.

Runs locally in your browser

Input

4 lines · 277 characters
You are a support assistant for an online bookshop. Answer in two or three sentences, in the customer's language.

Customer: Merhaba! I ordered "The Silent River" on 28 October (order #48213), but the tracking page still says "label created". Will it arrive before the 5th? 📦

Tokens

Tokens in the text, by tokenizer and model family
ModelsTokensKind
OpenAI o200k_baseGPT-5, GPT-4.1, GPT-4o, o1, o3, o4-mini—Exact
OpenAI cl100k_baseGPT-4, GPT-3.5 Turbo, text-embedding-3—Exact
ClaudeAnthropic: 1M tokens is about 555k words or 2.5M Unicode characters. Source(opens in a new tab) · as of 2026-10-30—Estimate
GeminiGoogle: A token is about 4 characters; 100 tokens are about 60 to 80 English words. Source(opens in a new tab) · as of 2026-10-30—Estimate
DeepSeekDeepSeek: An English character is about 0.3 tokens and a Chinese character about 0.6. Source(opens in a new tab) · as of 2026-10-30—Estimate
MistralMistral AI: About 400 to 600 characters make 100 to 150 tokens, Mistral's rule of thumb for splitting documents. Source(opens in a new tab) · as of 2026-10-30—Estimate
  • Exact counts use OpenAI's published tokenizers. OpenAI has not published the tokenizer of its GPT-6 models, so no count here is exact for them.
  • Estimates apply each provider's published average to this text; real counts vary with the language and the kind of text.
  • Chat APIs add a few tokens for each message's role and format, and more for tools and images; those are not counted here.
Characters
—
Words
—
Lines
—
UTF-8 bytes
—

Tokens in the text

Each colored box is one token; a character split across tokens shares a box. Spaces show as ·, tabs as →, line breaks as ↵. Hover over a token, or turn on Token IDs, to see its number in the tokenizer's vocabulary.

What the AI token counter does

The counter shows how many tokens a text takes for the language models you plan to send it to. For OpenAI's models it counts exactly, with the same o200k_base and cl100k_base tokenizers OpenAI publishes, run in your browser. For Claude, Gemini, DeepSeek and Mistral it applies each provider's published average and shows the result as an estimate. It also counts characters, words, lines and bytes, and shows where the text splits into tokens.

How to count tokens

  1. Paste a prompt, a document or any text, or open a text file of up to 2 MB.
  2. The counts follow your typing. Text over 1 MB is counted when you select Count or press Ctrl+Enter.
  3. Read the exact counts for OpenAI's tokenizers and the estimates for the other model families, each with its source.
  4. Under Tokens in the text, see each token as a colored box. Switch the tokenizer, or turn on Token IDs to see each token's number.
  5. Select Estimate cost to take the o200k_base count to the LLM Cost Calculator as the input tokens of a request.

Examples

A short greeting

Input

Hello, world!

Output

o200k_base (GPT-5, GPT-4.1, GPT-4o, o1, o3, o4-mini): 4 tokens
cl100k_base (GPT-4, GPT-3.5 Turbo, text-embedding-3): 4 tokens
Claude (estimate): ~4–5 tokens
Gemini (estimate): ~3 tokens
DeepSeek (estimate): ~4 tokens
Mistral (estimate): ~3 tokens
Characters: 13
Words: 2
Lines: 1
UTF-8 bytes: 13
Accents and an emoji: 12 characters, 17 bytes

Input

naïve café 🙂

Output

o200k_base (GPT-5, GPT-4.1, GPT-4o, o1, o3, o4-mini): 5 tokens
cl100k_base (GPT-4, GPT-3.5 Turbo, text-embedding-3): 5 tokens
Claude (estimate): ~4–5 tokens
Gemini (estimate): ~3 tokens
DeepSeek (estimate): ~4 tokens
Mistral (estimate): ~3 tokens
Characters: 12
Words: 2
Lines: 1
UTF-8 bytes: 17
Text that looks like a special token

Input

<|endoftext|>

Output

o200k_base (GPT-5, GPT-4.1, GPT-4o, o1, o3, o4-mini): 7 tokens
cl100k_base (GPT-4, GPT-3.5 Turbo, text-embedding-3): 7 tokens
Claude (estimate): ~2–5 tokens
Gemini (estimate): ~1–3 tokens
DeepSeek (estimate): ~4 tokens
Mistral (estimate): ~3 tokens
Characters: 13
Words: 1
Lines: 1
UTF-8 bytes: 13

The third text is counted as its 13 characters, not as the special token that marks the end of a text: tokenizers add special tokens themselves, so text that only looks like one counts as ordinary characters.

What a token is

A model does not read letters or words but tokens: pieces of text from a fixed vocabulary, about 200,000 entries in OpenAI's newest tokenizer. A common English word is one token, often with the space before it, as in " world". A rare word, a long number, code and many words in other languages split into several tokens. Punctuation, line breaks and runs of spaces are tokens too.

Providers bill every request by its input and output tokens and limit each request to a number of tokens, the context window. Knowing the count before you send a prompt tells you whether it fits and what it costs.

Exact counts and estimates

OpenAI publishes its tokenizers in its tiktoken library, so this page runs the same vocabulary files in your browser and its counts are exact. In tiktoken 0.14.0, the GPT-5, GPT-4.1, GPT-4o, o1, o3 and o4-mini models use o200k_base, and GPT-4, GPT-3.5 Turbo and the text-embedding-3 models use cl100k_base. OpenAI has not published the tokenizer of its GPT-6 models; for those, only the usage the API reports is exact.

For Claude, Gemini, DeepSeek and Mistral, the page has no tokenizer it can run in your browser: an exact count comes from the provider's own API, which needs a key and receives your text, or its own software. Instead, the page applies the average each provider publishes: a number of characters or words per token, or of tokens per character. Where a provider gives two figures, such as characters and words, the estimate is the range between them. We found no such figure for xAI's Grok or Meta's Llama models, so the page shows no estimate for them.

o200k_base and cl100k_base

cl100k_base has about 100,000 tokens in its vocabulary and came with GPT-4 and GPT-3.5 Turbo. o200k_base, with about 200,000, came with GPT-4o and is used by the newer OpenAI models. The larger vocabulary has more whole words of other languages, so the same text often takes fewer tokens: in the table below, the Turkish sentence takes 37 tokens in cl100k_base and 28 in o200k_base. For English the two often match.

Why other languages use more tokens

A vocabulary holds the pieces that were most common in the text it was built from. English words are often single tokens, while words in many other languages split into more pieces, so the same message can take very different counts:

LanguageTextCharacterso200k_basecl100k_base
EnglishThe meeting is moved to Thursday at 3 pm. Please bring the signed contract.751717
TurkishToplantı perşembe saat 15.00'e alındı. Lütfen imzalı sözleşmeyi getirin.722837
Chinese会议改到星期四下午三点。请带上签好的合同。211622

The Turkish message has about as many characters as the English one but takes 65% more tokens with o200k_base, and the Chinese one has under a third of the characters but almost as many tokens. The published averages describe typical text, so estimates for text in other languages, and for code, are rougher than for English prose.

How to use fewer tokens

  • Send JSON without indentation. Spaces and line breaks are tokens too; the JSON Minifier removes them without changing a value.
  • Remove markup and repetition. HTML tags, attribute names and boilerplate repeated in every request add tokens without adding meaning.
  • Ask for shorter answers. Output tokens usually cost several times as much as input tokens.
  • Keep the repeated part at the start. It does not shrink the count, but providers bill a cached beginning of a prompt at a fraction of the price.

Options

Options
OptionValuesDefaultWhen to change it
Tokenizero200k_base, cl100k_baseo200k_basecl100k_base to see how GPT-4, GPT-3.5 Turbo or an embedding model splits the text. Both are counted either way.
Token IDsOn, OffOffOn to show each token's number in the tokenizer's vocabulary, for comparing with an API's logprobs or a tokenizer in code.

Common errors and fixes

Common errors and how to fix them
CodeWhat it meansHow to fix it
TOKENS_SPECIAL_TEXTNoteThe text contains something that looks like a special token, such as <|endoftext|>. It is counted as ordinary characters.Nothing to fix: the count treats it as text. Remove it if it was pasted by mistake.
INPUT_TOO_LARGEErrorThe text is over 2 MB, about 500,000 tokens of English.Count the text in parts and add the counts up.

Privacy

AI Token Counter runs entirely in your browser. What you type, paste or open is processed on your device: it is not sent to Toolzami, and Toolzami does not store it. Only the options you choose are remembered, in this browser.

Frequently asked questions

Is the Claude token count exact?

No. Anthropic does not publish its tokenizer: an exact count comes from its token counting API, which needs an API key and receives your text. This page applies Anthropic's published average for its current models, about 555,000 words or 2.5 million characters per million tokens, so read the result as a range.

Why does the API report more input tokens than this counter?

The API counts the whole request: the system prompt, every message with the tokens that mark its role, tool definitions, images and files. Count the full text of a request to get close, and expect a few more tokens per message.

Which tokenizer do GPT-6 models use?

OpenAI has not published it. Its tokenizer library, tiktoken 0.14.0, maps the GPT-5, GPT-4.1, GPT-4o and o-series models to o200k_base, and no GPT-6 model yet. Until it does, the token usage in each API response is the exact count for GPT-6.

Last updated