You did the sensible thing: you checked the word count, applied a rough tokens-per-word ratio, and concluded your prompt would fit comfortably. Then the model rejected it as too long, or the API charge came in higher than the estimate. The estimate was not careless. It was built on the one measure that fails exactly where real prompts stop looking like plain English prose.
Tokens are sub-word pieces, and tokenizers hand out single tokens to the text they see most often. Frequent English words usually cost one token each, which is why word-based ratios seem to work in casual tests. Code, emojis and text in other languages break the pattern, each for the same underlying reason: none of them is made of frequent words. This guide walks through the mistakes that follow from missing that point, and how to avoid them with the free Token Counter on Ovatly, which runs a real BPE tokenizer in your browser and never uploads your text.
Contents
- Quick answer
- Why the word count misleads
- Where the extra tokens hide: code and symbols
- Where the extra tokens hide: emojis
- Where the extra tokens hide: other languages
- How to count tokens, step by step
- Worked example: three short texts, counted exactly
- Limitations
- Common mistakes
- FAQs
- Conclusion
Quick answer
Never estimate tokens from a word count when the text contains code, emojis or non-English passages. Tokenizers give frequent words a single token and split everything else into smaller pieces, so those texts usually take more tokens per word than English prose. Paste the actual text into the Token Counter instead: it counts with the GPT-4o family tokenizer (o200k encoding), shows tokens alongside characters, words, sentences and paragraphs, and the count is exact for that family and a close approximation for Claude, Gemini and others.
Why the word count misleads
A tokenizer does not read words; it reads pieces. Frequent words tend to be single tokens. Unusual words become several tokens. Punctuation and spaces attach to neighboring tokens rather than standing alone. Two texts with identical word counts can therefore have very different token counts, because what matters is how much of the text is made of the frequent patterns the tokenizer knows as single pieces.
Plain English prose is the best case, which is why rough ratios survive casual testing. The mistakes in this guide all come from applying that best-case ratio to text that is not plain English prose.
Where the extra tokens hide: code and symbols
Code looks dense with short words, so it feels like it should be cheap. It is not. A line of code is mostly symbols, brackets, operators and indentation, plus identifiers that appear in no ordinary vocabulary. None of that matches the frequent-word patterns, so it splits into more pieces. The counter's own notes state the rule directly: rare words, code and non-English text usually take more tokens per word.
The practical consequence is that a configuration file, a stack trace or a long code sample pasted into a prompt can cost far more than the same number of words of explanation around it. If your prompt mixes prose instructions with a large code block, count the whole assembled prompt, not the prose alone.
Where the extra tokens hide: emojis
An emoji is not part of any word, so it never rides along inside a word token the way punctuation does. Each emoji is its own piece of content for the tokenizer, and a string of emojis adds tokens one after another while adding nothing to the word count at all. A message that looks like ten words and a row of reaction emojis is, in token terms, the ten words plus every emoji on top.
This rarely matters for a single smiley in a chat prompt. It matters in bulk content: social posts, chat exports and feedback data full of emojis can run noticeably above a word-based estimate, and the gap is invisible until you count the real text.
Where the extra tokens hide: other languages
The tokenizer's vocabulary of single pieces was built around the text it was trained on, which is dominated by English. Frequent English words earned whole tokens; words in other languages mostly did not, so they split into smaller pieces and take more tokens per word. The counter's notes say the same thing in one line: non-English text usually takes more tokens per word.
There is no honest fixed multiplier to apply instead. How much more a given passage costs depends on the language, the script and the specific words, and it differs again between model families, because Claude, Gemini and other families split text differently from the GPT tokenizer. The only reliable figure is a count of your actual text. The companion guide, linked at the end, goes deeper on how this works for Urdu and Hindi.
How to count tokens, step by step
- Open the Token Counter.
- Paste or type the text you want to measure, exactly as you plan to send it, including code blocks, emojis and any non-English passages.
- Click Count tokens.
- Read the token count together with the character and word counts. The gap between the word count and the token count tells you how far a word-based estimate would have been off for this text.
- If the count is headed for a context limit or a budget, use it with the Context Window Checker or the Prompt Cost Calculator to see fill levels or prices before you send.
Worked example: three short texts, counted exactly
The counter's own documented example shows the pattern at small scale. The greeting "Hello, world!" counts as 4 tokens, 13 characters, 12 characters without spaces, 2 words and 1 sentence. The token count is double the word count even here, because the comma and the exclamation mark attach to the neighboring tokens and "Hello" and "world" are separate pieces.
For comparison, "The quick brown fox jumps over the lazy dog" is 9 tokens for 9 very frequent words, close to the one-token-per-word best case. A fuller sentence, "Prompt engineering is the practice of writing instructions for AI models.", is 12 tokens. Plain, frequent English sits near one token per word; the further your text moves from that profile, toward code, symbols, emojis or other languages, the wider the gap grows, which is why these three calm examples are the floor for your estimates, not the average.
Limitations
The count is exact for the GPT-4o family, whose o200k encoding the counter runs. For Claude, Gemini and other families it is a close approximation, not an exact figure, and the providers' own counters are the authority for their models. The tool counts the raw text only: real chat APIs add a few tokens per message for role markers and structure, so treat the result as the content size, not the final API payload. Very long pastes are counted on your own device, and a full book can take a moment.
Common mistakes
- Estimating tokens from word counts. The ratio only holds for frequent English prose and fails on everything else in this guide.
- Counting the prose and forgetting the payload. Code blocks, pasted data and document extracts are part of the prompt; count the assembled whole.
- Ignoring emojis in bulk text. Each one adds tokens while adding nothing to the word count.
- Applying one multiplier to every language. Non-English text usually costs more per word, but the amount varies; measure the real passage.
- Treating an approximation as exact. For non-GPT families the count guides you well, but the provider's own counter settles billing and limits.
FAQs
Why does the token count differ from the word count? Tokenizers split text into sub-word pieces. Frequent words tend to be single tokens, unusual words become several, and punctuation and spaces attach to neighboring tokens.
Why does code cost more tokens than plain English of the same length? Code is full of symbols, indentation and rare identifiers rather than frequent words. The counter's notes put it plainly: rare words, code and non-English text usually take more tokens per word, so a page of code normally costs more than a page of prose with the same word count.
Is this the exact count for Claude or Gemini? No. It is exact for the GPT-4o family encoding it uses, and an approximation for other families. Providers' own counters are the authority for their models.
Does chat formatting add tokens? Yes, real chat APIs add a few tokens per message for role markers and structure. This tool counts the raw text only, so treat the result as the content size, not the final API payload.
Is my text uploaded for counting? No. The tokenizer runs in your browser; nothing leaves the page.
Conclusion
Every token counting mistake in this guide is the same mistake: trusting a word-based estimate for text that is not plain English prose. Count the real, assembled text with the Token Counter and the surprises mostly disappear. For the language side of the story in more depth, read the companion guide, How Tokens Work in Different Languages, Including Urdu and Hindi. More guides like this live in the AI and Prompt Tools guides archive.