You have written a careful prompt, pasted in a long document for context, and pressed send. Then one of two things happens: the model refuses because the input is too long, or the API bill arrives larger than you expected. Both outcomes are decided by a unit most writing tools never show you: the token.

Tokens are the pieces a model actually reads. Context limits are set in tokens, and per-token prices are charged in tokens, so the word count in your editor is only a rough hint at the number that matters. This guide explains what a token is, why it differs from a word, and how to count tokens before you send, using the free Token Counter on Ovatly. The counter runs a real BPE tokenizer in your browser, so your text is never uploaded, and it shows characters, words, sentences and paragraphs alongside the token count.

Contents

  • Quick answer
  • What a token actually is
  • Why you count before you send
  • How to count tokens, step by step
  • Worked example: a short greeting, counted exactly
  • Exact for GPT, approximate for other families
  • Limitations worth knowing
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

Paste your text into the Token Counter and click Count tokens. The tool counts with the gpt-tokenizer package using the o200k encoding, the GPT-4o family tokenizer, and reports the token count together with characters, words, sentences and paragraphs. Treat the figure as exact for the GPT-4o family. For Claude, Gemini and other families, which split text differently, treat it as a close approximation rather than an exact figure. Remember that the count covers your raw text only: real chat APIs add a few tokens per message for role markers and structure, so the final API payload is slightly larger than the number you see.

What a token actually is

A token is a chunk of text produced by a tokenizer, the component that splits writing into the pieces a model processes. The counter uses BPE, short for byte pair encoding: the tokenizer learns which character sequences are common and stores them as single pieces. Frequent words tend to survive whole, so a common short word is often one token. Unusual words are split into several pieces, and punctuation and spaces attach to neighbouring tokens rather than standing alone.

This is why tokens are not words. A two-word greeting can be four tokens once its punctuation is counted, while a nine-word sentence of very common words can be nine tokens, one per word. Code usually takes more tokens per word than plain prose, because symbols and spacing split into many small pieces. Non-English text usually takes more tokens per word too. The practical lesson is simple: there is no fixed words-to-tokens ratio you can trust for your own text. You have to count the actual text.

Why you count before you send

Two limits are expressed in tokens. The first is the context window: the maximum amount of text a model can take in at once. Paste a prompt or document that is too long and the request fails, or the conversation runs out of room. Knowing the token count first lets you check the fit before you send; the Context Window Checker turns a count into fill levels and spare tokens for specific models.

The second limit is price. Models with per-token pricing charge in proportion to the token count, so a prompt you reuse hundreds of times costs according to its tokens, not its words. A count taken once tells you what each call carries, and the Prompt Cost Calculator builds price estimates from counts when you need them. Counting first is a short habit that prevents both failure modes: the refused request and the surprise bill.

How to count tokens, step by step

  1. Open the Token Counter and paste or type the text you want to measure. Use the exact text you plan to send, including instructions and pasted context, because every part of it counts.
  2. Click Count tokens.
  3. Read the token count together with the character and word counts. The panel also shows sentences and paragraphs, which helps you check that a long paste arrived complete.
  4. Use the count with the Context Window Checker if you need fill levels for a model, or with the Prompt Cost Calculator if you need a price.

Worked example: a short greeting, counted exactly

The counter's own example shows how the measures diverge. Take the text "Hello, world!". The result is 4 tokens, 13 characters, 12 characters without spaces, 2 words and 1 sentence. Two words became four tokens because the comma and the exclamation mark are pieces too, attached to the words beside them.

Compare two longer strings. "The quick brown fox jumps over the lazy dog" is 9 tokens: nine very common words, one token each. A fuller sentence, "Prompt engineering is the practice of writing instructions for AI models.", is 12 tokens. Both sit close to one token per word because every word in them is common. Real prompts sit between these tidy cases and the messy ones: add rare names, technical terms, code or another language and the tokens climb faster than the words. That gap, invisible in a word count, is exactly what the counter exists to reveal before the text leaves your machine.

Exact for GPT, approximate for other families

The count is produced with the GPT tokenizer (o200k encoding), so for the GPT-4o family it is the exact figure those models work with. Other families split text differently: Claude, Gemini and others run their own tokenizers, so the same text becomes a different number of pieces for them. For those models this count is a close approximation, good enough to judge whether a document fits a window or to compare two drafts of a prompt, but not the final authority. When an exact figure for another family matters, the provider's own counter is the authority for its models.

Limitations worth knowing

Three limits are worth keeping in mind. First, 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. Second, very long pastes are counted on your own device; a full book can take a moment. Third, a count tells you size, not quality: a short prompt can still be a vague prompt, and trimming tokens only helps when the text that remains still says what you need.

Common mistakes

  • Estimating tokens from the word count. A fixed ratio fails exactly where it matters: code, rare words and non-English text all run higher than prose.
  • Counting only the question. Pasted documents, instructions and examples count too. Measure the whole text you plan to send.
  • Assuming the GPT count is exact everywhere. For Claude, Gemini and other families it is an approximation; their own counters settle disputes.
  • Editing after counting. A prompt that grows by a pasted page after you counted it is a different size. Recount the final version.
  • Forgetting the formatting overhead. The API payload is slightly larger than the raw text count once role markers and structure are added.

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.

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.

What else does the counter show besides tokens? Alongside the token count it shows characters, words, sentences and paragraphs, so you can compare the measures side by side and check that a long paste arrived complete.

Conclusion

Counting tokens before you send takes seconds and removes the two nasty surprises of working with models: the input that does not fit and the bill you did not expect. Paste the final text into the Token Counter, read the token count next to the word count, and treat the figure as exact for the GPT-4o family and a close guide for everyone else. When your problem is not size but the exclusions an image model should respect, the sibling guide What Is a Negative Prompt and How Do You Write One? covers the other side of prompt craft. More guides like these live in the AI and Prompt Tools guides archive.