How Many Tokens Is Your Prompt? A Practical Guide to LLM Costs

·7 min read

Every LLM invoice comes down to one number: tokens. Miscount them by 20% and you'll be off by 20% on cost, latency and how much context you can actually pack into a request. This post is the plain-English guide: what a token is, how to count it accurately, and five levers that cut your spend without hurting output.

What a token is (and isn't)

A token is a chunk of text the model treats as a single unit. It is not a word, a character or a syllable. Models split text using byte-pair encoding (BPE) or SentencePiece, which learns common substrings from the training data.

Rules of thumb for English:

  • 1 token ≈ 4 characters.
  • 1 token ≈ 0.75 words.
  • 100 tokens ≈ 75 words ≈ a short paragraph.
  • Rare words and non-Latin scripts (Arabic, CJK, emoji) use more tokens per character.

Input vs output tokens

You pay for both, but at different rates. Output tokens are almost always more expensive — often 3–5× the input price — because generation is more compute-intensive than reading. When you estimate cost, compute the two halves separately and add them.

Rough 2026 rates (check the official pricing page for the latest):

  • GPT-4o Mini — $0.15 / M input, $0.60 / M output.
  • GPT-4o — $2.50 / M input, $10.00 / M output.
  • Claude 3.5 Sonnet — $3.00 / M input, $15.00 / M output.
  • Gemini 1.5 Flash — $0.075 / M input, $0.30 / M output.

How to count tokens accurately

Each family uses a different tokenizer, so counts vary between GPT, Claude and Gemini for the same input. The right way to check is with the model's own tokenizer:

  • OpenAI GPT-4o / 4o mini: o200k_base encoding via tiktoken.
  • Claude: Anthropic's count_tokens endpoint or the shipped tokenizer.
  • Gemini: countTokens in the Gemini SDK.

If you don't want to install SDKs, paste the text into our Token Counter and pick the model — it runs the correct tokenizer in your browser and shows both input and estimated output cost.

Five levers to cut token spend

  1. Shorten the system prompt. System prompts are paid for on every call. Trim examples, delete role-play preambles, and move rarely-used rules into few-shot examples that only run when needed.
  2. Cap max output length. Setting max_tokens is a hard ceiling — the model can't spend more even if it wants to.
  3. Retrieve, don't stuff. Instead of sending a 50-page manual, chunk it, embed it, and retrieve the top 3 passages. You'll cut prompt tokens 10–100×.
  4. Use a cheaper model for the easy 80%. Route simple classification and rewriting to GPT-4o Mini or Gemini Flash. Reserve GPT-4o and Claude Sonnet for hard tasks.
  5. Cache what's stable. Providers now offer prompt caching — repeated system prompts and long documents can drop to 10% of the input rate on cache hits.

Common mistakes

  • Estimating tokens as words. You'll be off by 25–40% depending on the tokenizer and the language.
  • Forgetting the conversation history. In a chat loop, each turn re-sends every prior message. Tokens grow quadratically unless you summarize or truncate.
  • Ignoring image and audio tokens. Vision inputs are billed by tile size; audio by seconds. Both convert to token-equivalents your text-only estimate misses.

Check any prompt right now

Paste your prompt into the Token Counter, pick the model you plan to use, and see tokens plus a monthly cost projection based on your request volume. Everything runs in your browser — no key upload.

Keep reading