Every request to a large language model is billed in tokens — and tokens are not words, characters, or anything you can eyeball reliably. A short prompt can cost more than a long one, code costs more than prose, and the reply usually costs more than the question. Developers who never count tokens first tend to discover this from an unexpectedly large bill.
This guide explains what a token actually is, why counts differ between models, how to count tokens before you send a request, and the practical habits that keep API costs predictable.
What a token actually is
A token is a chunk of text produced by the model's tokenizer — usually a subword unit created by byte-pair encoding. Common English words are often a single token, rarer words split into two or three, and punctuation, whitespace, and code symbols each consume tokens of their own. As a rough rule of thumb, one token is about four characters of English text, or about three-quarters of a word — so 100 tokens is roughly 75 words.
That average hides wide variation. Source code is token-hungry: indentation, brackets, and long identifiers all add up, and a JSON payload can cost far more tokens than the same information in plain sentences. Non-English text typically costs more per word than English, because tokenizers are trained mostly on English data. Minifying JSON before sending it — removing the whitespace a model does not need — is one of the easiest savings available, and a JSON Minifier does it in one click.
Why estimates go wrong
The first reason is that every model family has its own tokenizer. GPT-4o, Claude, Gemini, and Llama do not split text the same way, so the same prompt can be 500 tokens on one model and 620 on another. Any count is only exact for the tokenizer it was measured with — a count from the wrong tokenizer is an estimate, sometimes off by 20% or more.
The second reason is forgetting what counts. The bill covers everything sent and everything received: the system prompt, the conversation history, any tool or function definitions, and the model's reply. The reply — output tokens — usually costs more per token than the input on most providers, sometimes several times more, so a long answer dominates the cost of a short question.
The third reason is invisible tokens. Models add special markers around messages — start-of-message, end-of-turn, role tags — that you never typed but still pay for. They are a small overhead per message, but across a long conversation with many turns they add up.
Counting before you pay: the workflow
Before sending anything expensive, run through these steps:
- Paste your full prompt — system prompt included — into a Token Counter and count it with the tokenizer closest to your model.
- Add your expected reply length. If you asked for a 500-word answer, budget roughly 650–700 output tokens.
- Multiply input tokens by the model's input price and output tokens by its output price (both are quoted per million tokens). Add a 10–20% buffer for tokenizer differences and special tokens.
- For repeated calls — a loop, a batch job, an agent — multiply the single-call estimate by the number of calls before you start, not after.
Practical ways to cut token costs
The cheapest token is the one you never send. Trim system prompts to the instructions the model actually needs, and drop verbose examples once the model behaves. Summarize long conversation history instead of re-sending it in full on every turn. Send compact data — minified JSON, short keys, no redundant fields — rather than pretty-printed payloads. If your provider supports prompt caching, put the stable, repeated prefix of your prompt first so it can be cached across calls.
Model choice matters as much as prompt length. A smaller or cheaper model often handles classification, extraction, and formatting just as well as a flagship model at a tenth of the price. Reserve the expensive model for the steps that genuinely need it, and route the routine work elsewhere.
Token-counting pitfalls
Counting only the user message is the most common mistake — the system prompt, history, and tool definitions are billed too. A close second is assuming characters equal tokens: a 10,000-character prompt is not 10,000 tokens, but it is not 2,500 either — it depends on the content, and only a real tokenizer gives the true number. Finally, remember that images, PDFs, and audio are tokenized by separate rules entirely; a screenshot attached to a prompt can cost hundreds of tokens on its own, and text-based counters cannot measure it.
Try it yourself
Frequently asked questions
How many tokens is 1,000 words?
Roughly 1,300 tokens for ordinary English prose, using the rule of thumb that one token is about three-quarters of a word. Code, JSON, and non-English text cost more per word, so treat the estimate as a starting point and count exactly for anything you will pay for.
Are input and output tokens priced the same?
Usually not. On most providers, output tokens cost more than input tokens — often two to five times as much. That means a long reply dominates the cost of a request, and asking for concise answers is a real cost control.
Why do two token counters give different counts?
Because they use different tokenizers. Each model family — GPT, Claude, Gemini, Llama — splits text differently, so the same text has a different exact count on each. A count is only exact for the tokenizer it was measured with; everything else is an approximation.
Do system prompts count toward my token bill?
Yes. Everything sent to the model is billed: the system prompt, the conversation history, tool and function definitions, and the user message. A long system prompt repeated on every call in a loop can quietly become your biggest cost.
Can I count tokens offline?
Yes. Tokenizers are deterministic algorithms, so counting can run entirely in your browser with no data sent anywhere. The Token Counter on this site counts locally, which also means your prompts stay private while you measure them.