If you are building with an LLM API, you need to count tokens to estimate cost and stay inside the context window. Tokens are the unit models read, generate, and bill by, so a quick count tells you whether a prompt will fit and roughly what it will cost. Here is how tokens work and how to measure them.
What a token is
A token is a chunk of text, often a word piece rather than a whole word. The string “tokenization” might split into “token” and “ization”, while a common word like “the” is usually a single token. A rough rule of thumb for English is about 4 characters or about 0.75 words per token. So 1,000 tokens is roughly 750 words.
Treat that as a rough estimate, not a guarantee. The only exact count comes from running the actual tokenizer for your model.
Why token counts matter
Tokens drive both limits and billing, in two places:
- Cost: APIs price per token, and both the prompt (input) and the completion (output) are billed. A long system prompt you send on every request adds up fast.
- Context window: prompt plus completion must fit inside the model’s window. If your input is already near the limit, there is little room left for the response.
Counting before you send helps you trim prompts, budget output length, and avoid hard failures when a request overflows the window.
How to count tokens
The fastest way is to paste your text and read the number:
- Open the LLM Token Counter.
- Paste your prompt, including any system message and examples.
- Read the token count, and add a margin for the completion you expect back.
- Trim or restructure the prompt if the total is close to your model’s context window.
The LLM Token Counter runs entirely in your browser, so your prompt never leaves your device.
Why counts vary between models
There is no single token count for a piece of text. Different models use different tokenizers, so the same paragraph can produce different totals depending on which one you target. A count from one model’s tokenizer is a good ballpark for another, but not exact.
Some content also tokenizes less efficiently than plain English prose:
- Code uses lots of symbols, indentation, and punctuation, which fragments into more tokens per character.
- Non-English text, especially scripts that are not Latin-based, often needs more tokens per word.
- Rare or made-up words get split into several small pieces instead of one clean token.
When your text is code-heavy or multilingual, assume the count will run higher than the 0.75-words-per-token rule suggests, and measure rather than guess.
Related tools
- Word & Character Counter - count words and characters, which pairs well with token estimates.
- Readability Score Checker - check how dense your prompt reads before you trim it.
- Case Converter - quickly reformat text you are preparing for a prompt.
Count first, trim what you can, and you will spend less and overflow never.