In one line
AI models don't read words. They read tokens, and you pay per token. This page's token optimizer shows how many tokens your prompt costs on each model and what's wasted; the lesson below teaches you why, and how to write leaner prompts for any AI.
Don't read yet. Play first. Paste a prompt you actually use into the tool below (or hit "Try an example") and press Analyze. Everything you're about to learn will make ten times more sense once you've seen your own words turned into a bill.
6Try the token optimizer
0 characters · 0 words
How many tokens, per AI model
Same words, different price tags. Each company chops text into pieces differently.
How much of the AI's memory you used
Compared with a large 200,000-token context window (the AI's short-term memory).
0% of a 200K window
Where your tokens are being wasted
The struck-through bits are polite filler the AI doesn't need.
About 0 tokens (0%) look like removable filler.
A leaner version (same meaning)
Auto-trimmed by removing the filler. 0% smaller
This is a quick demo trim. A real rewrite also merges overlapping sentences. The lesson below shows you how to do that by hand.
What's inside
1What a token is
You just watched the tool do something strange: it counted your prompt and got a number that is not your word count and not your character count. That's because AI models never see your words. Before your prompt reaches the model, a tokenizer (the thing that chops your text into pieces) splits it into tokens, and the model reads (and bills) those pieces.
Think of it like LEGO bricks
The tokenizer snaps your sentence into LEGO bricks. A common word like "the" is one big brick. A rarer word like "understanding" gets broken into smaller bricks: maybe under + standing. Even "ChatGPT" might be three bricks: Chat + G + PT. And you pay per brick, not per word, not per letter.
A token is roughly a word-chunk. A few quirks worth knowing: a space usually attaches to the word after it (so " hello" is one token), and an emoji like 🚀 is often 1-3 tokens on its own.
For everyday English, two rules of thumb get you close:
- 1 token ≈ 4 characters
- 1 token ≈ 0.75 words, so 100 tokens is about 75 words, and one page (~500 words) is roughly 660-700 tokens.
These are estimates. The exact number depends on which tokenizer the model uses. As you saw in the tool's per-model cards, that is why the same prompt gets a different count on each model.
2How tokens are calculated
Before the model ever exists, its makers build a vocabulary of chunks by scanning a huge pile of text and asking, over and over: "Which two pieces appear next to each other most often? Glue them together."
Glue "t" and "h" enough times and you get "th"; glue "th" and "e" and you get "the". Repeat millions of times and you end up with a dictionary of, say, 100,000 or 200,000 chunks: frequent words become single chunks, and rare words stay broken into familiar fragments.
When you hit "Analyze", the tokenizer walks through your prompt left to right and greedily matches the longest dictionary chunks it can find. The result is a list of chunk IDs, and your token count is simply the length of that list.
For the 20% Under the hood: BPE, vocabularies, and exact counting
The merge-the-most-frequent-pair algorithm is BPE, or Byte-Pair Encoding (Gemini uses its cousin, SentencePiece). Because BPE falls back to raw bytes, anything is representable: any language, emoji, or binary.
Exact counting is only possible where the tokenizer is public:
- GPT family: the open-source
tiktokenlibrary, witho200k_base(~200k vocab) for GPT-4o/4.1/o-series,cl100k_base(~100k vocab) for GPT-4/3.5. This page's tool uses the same encodings viagpt-tokenizerin your browser, which is why GPT cards say "exact". - Claude: proprietary BPE, vocab not public. Exact counts come only from Anthropic's
count_tokensAPI endpoint. - Gemini: SentencePiece, not public. Exact counts come from Google's
countTokensAPI. - Llama 3.x (BPE, 128k vocab) and Mistral's "Tekken" (tiktoken-based, ~130k) have open tokenizers.
For non-GPT models the tool applies calibrated character ratios (Claude ÷3.6, Gemini ÷4.0, Llama ÷3.8, Mistral ÷3.9) and labels them estimates, ±10%.
3Why the same prompt costs different amounts on different models
Look back at the tool's model cards. Same prompt, six different numbers. Each company trains its own tokenizer, on its own pile of text, with its own dictionary size.
And dictionary size matters: a bigger vocabulary generally means fewer tokens for the same text, because more whole words fit in a single chunk. That's why GPT-4o's ~200k-chunk tokenizer usually produces about 5-15% fewer tokens than the older ~100k tokenizers, and why Claude counts tend to run slightly higher than GPT counts for identical English text.
A token isn't a universal unit like a centimeter. It's each company's own measuring tape, which is why one prompt has six different price tags.
Exactly as the tool shows it: only the GPT counts are exact, because OpenAI's tokenizer is open source and runs right in your browser here. Claude, Gemini, Llama and Mistral counts are labeled estimates (±10%), because exact counts for those require each vendor's own counting API.
4What inflates your token count
Not all text is equally "token-dense". Because tokenizer dictionaries were built mostly from common English, anything unusual fragments into more, smaller bricks, and costs more:
| Content type | Effect on tokens | Why |
|---|---|---|
| Source code | +20-40% vs prose | Symbols, casing and indentation fragment poorly |
| JSON with whitespace | Heavy inflation | Every quote, brace and indent costs tokens |
| Non-English text | 2-8× more per word | Tokenizers are trained mostly on English; Indic and CJK scripts shatter into many small tokens, which matters if you work in Hindi, Tamil or other Indian languages |
| Numbers | ~1 token per 1-3 digits | Digits rarely merge into bigger chunks |
| Repeated boilerplate | Full cost, every call | The model re-reads it on every single request |
Quick experiment
Scroll up and paste the same short message into the tool twice: once in English, once in Hindi or Tamil. Watch the counts jump. Then try a snippet of pretty-printed JSON. Seeing it once teaches more than any table.
5Why output tokens and long chats cost more
So far we've only counted your prompt tokens (the input). But the bill has two sides:
Total cost = input tokens × input rate + output tokens × output rate
Two facts here surprise almost everyone:
First: the AI's answer costs more per token than your question. Output tokens typically bill at 2-5× the input rate. So the single biggest saving is usually telling the AI to keep its answer short and structured, rather than shortening your prompt. (We never quote specific per-token prices here; they change frequently, so always check the vendor's live pricing page.)
Second: in a chat, the whole conversation is the input. Every time you send a new message, all the previous turns get re-sent, and re-billed, along with it. That's why a long back-and-forth gets progressively more expensive per message, even when your new question is one line.
For the 20% Context windows and prompt caching
The re-sent history lives in the context window: the model's short-term memory, measured in tokens (the tool's meter compares your prompt against a large 200,000-token window). Where vendors support prompt caching, repeated prefixes (system prompts, long documents, prior turns) are discounted rather than billed at full rate, a major lever for agents and pipelines that re-send the same boilerplate thousands of times a day.
6How to write a leaner prompt for any model
The tool's auto-trim only does step one of this method. The same five moves work on every model, because they reduce bricks no matter whose tokenizer is counting:
Delete filler
Greetings, "please", "I was wondering if you could…", apologies, thank-yous, repeated instructions. The AI doesn't have feelings to spare, so this is pure cost, zero signal. (It's exactly what the tool strikes through in red.)
Compress
Merge sentences that say overlapping things. Turn paragraph-style requirements into terse labeled lines. If you included three examples, keep one minimal example.
Structure
Reorder into role → task → constraints → output format, with short labels instead of flowing prose. Structured prompts are both cheaper and more reliable.
Preserve meaning, always
Every requirement, fact, name and nuance survives. Optimization must never change what you're asking for. If cutting something could change the AI's behavior, keep it.
Constrain the output
Add an explicit length or format limit ("500 words", "a 5-row table"). Remember: output tokens are the expensive ones, so this step often saves more than all the others combined.
Watch the method work. Before, about 115 tokens:
"Hello! I was hoping you could possibly help me out with something. I need you to write a blog post for my website. The blog post should be about artificial intelligence agents. It should be informative and interesting. Please make sure the blog post is well-written and engaging for readers. The post should be around 500 words or so. Also, please make sure to include a catchy title for the blog post. Thank you so much for your help with this!"
After, about 28 tokens, roughly 75% saved:
"Write a 500-word engaging blog post on AI agents for a tech website. Include a catchy title."
Same instruction. A quarter of the cost. For one chat message, who cares. In an automated pipeline calling an AI thousands of times a day, that difference is real money.
Your turn
Scroll back up to the token optimizer, paste a prompt you use often, and apply the five steps by hand. Re-analyze your rewrite and watch the per-model numbers fall. That before/after feeling is the whole lesson.
Common questions
How many tokens is my prompt?
Why does Claude count differently than ChatGPT?
Do spaces and punctuation cost tokens?
Why are my bills higher in Hindi, Tamil or other Indian languages?
Why do output tokens cost more?
Why does a long chat get more expensive over time?
What you just learned
- Tokens are the real unit. AI reads and bills word-chunks (LEGO bricks), not words or letters. English: ~4 chars or ~0.75 words per token.
- Counting is just chunk-matching. A tokenizer greedily matches your text against its dictionary; the count is the length of that list.
- Every model measures differently. Different tokenizers and vocab sizes → different counts for the same prompt. Only open tokenizers (GPT) give exact numbers; the rest are estimates.
- Some text is expensive. Code +20-40%, heavy JSON, numbers, and non-English text (2-8× for Indian languages) all inflate counts.
- Output is the big lever. Answers bill at 2-5× the input rate, and chats re-send their whole history every turn.
- The five-step trim. Delete filler → compress → structure → preserve meaning → constrain output. The example went from ~115 to ~28 tokens (~75% saved).
Comments
No comments yet. Be the first.