LLM Tokens Explained: How They Work, Limits, Counting
In this article
LLM tokens are the chunks of text that language models read and generate, and they directly determine how much text you can send and receive, how fast the model responds, and what you pay. Every word, number, or punctuation mark you type gets broken into one or more tokens before the model processes it, and the token limit is the maximum number of these chunks the model can handle in a single request. This article explains what tokens are, how they are counted, why limits exist, and how to estimate your own usage.
What Exactly Is a Token?
A token is a unit of text that a language model treats as a single piece. Models do not read text character by character; they use a tokenizer that splits text into subwords, words, or even individual characters depending on the language and the tokenizer's vocabulary. For example, the word "tokenization" might become three tokens: "token", "iza", "tion". Common short words like "the" or "is" are usually one token each, while rare or misspelled words can break into several tokens.
Tokenization is not universal — each model family (GPT, Claude, Llama, etc.) has its own tokenizer with a different vocabulary and rules. This means the same sentence can produce different token counts in different models. For English text, a rough rule of thumb is that one token equals about 0.75 words, or roughly 4 characters. That means 100 tokens is about 75 words, and 1,000 tokens is about 750 words. For other languages, especially those with non-Latin scripts like Chinese or Arabic, tokens per word can be higher or lower.
How Tokens Are Counted
Token counting happens in three places: input, output, and the total context window. The input includes your prompt, any system instructions, and all conversation history. The output is the text the model generates. The context window is the sum of input and output tokens that the model can process at once.
Most providers show token counts in their API responses, and many offer a tokenizer tool to test your own text. A common practical method to estimate tokens without a tool is to multiply the number of words by 1.33 (since 1 token ≈ 0.75 words). For example, a 150-word paragraph is roughly 200 tokens. Punctuation and spaces count too — each comma, period, or space is typically part of the preceding token, but standalone symbols like emojis can be one or more tokens each.
Token Limits and Context Windows
Every LLM has a maximum context window, often called the token limit. This is the total number of tokens the model can handle in a single request, including both input and output. For example, a model with a 4,000-token limit can accept up to 4,000 tokens of input and output combined. If your input uses 3,500 tokens, the model can only generate 500 tokens of output before hitting the limit.
Common context window sizes range from 4,000 to 128,000 tokens or more, depending on the model version. Newer models tend to have larger windows, but a larger window does not mean better performance — it just means more capacity. When you exceed the limit, the API returns an error like "maximum context length exceeded" and you must shorten your input or reduce the output length.
Why Token Limits Exist
Token limits are a practical constraint based on the model's architecture and the hardware running it. Each token requires memory and computation, and the model's attention mechanism scales quadratically with the number of tokens. Doubling the token count roughly quadruples the compute needed, so limits keep response times reasonable and costs manageable.
Providers also use token limits to prevent abuse and to ensure fair usage across many users. Without limits, a single request could tie up a server for minutes or cost the provider a significant amount of money. The limit is a trade-off between capability and efficiency.
Token Costs and Pricing
Most commercial LLM APIs charge per token, with separate rates for input and output tokens. Input tokens are usually cheaper than output tokens because generating text requires more computation than reading it. Pricing is typically quoted per million tokens, and the exact rates vary by model and provider. For example, a model might charge $5 per million input tokens and $15 per million output tokens. That means a 1,000-token input and a 500-token output would cost about $0.005 for input and $0.0075 for output, totaling roughly $0.0125.
To reduce costs, you can shorten prompts, use fewer conversation turns, or set a lower max output token count. Many providers also offer free tiers or discounted rates for certain models, but the token-based billing model is standard across the industry.
How to Choose the Right Token Limit
When using an LLM API, you often set a max_tokens parameter that caps the output length. Choosing a good value depends on your task:
- For short answers or classifications, set a low limit like 50–100 tokens to save cost and prevent rambling.
- For emails or summaries, 200–500 tokens is usually enough.
- For long-form content like articles or reports, you may need 1,000–2,000 tokens or more.
- Always leave room in the context window for the output. If your input is long, reduce the max output accordingly.
It is better to start with a smaller limit and increase it if the response is cut off. Many APIs also have a finish_reason field that tells you if the response stopped because it hit the token limit or because it naturally ended.
Common Token-Related Problems and Solutions
One frequent issue is hitting the context limit in a chat application. When the conversation history grows too long, older messages get truncated or the request fails. The typical fix is to summarize previous messages or to keep only the most recent turns. Some applications automatically trim history, but you can also do it manually.
Another problem is miscounting tokens for non-English text. For example, a single Chinese character can be one or two tokens, while a long German compound word might be split into several tokens. Always test with the actual tokenizer if you are working with non-English content. Also, be aware that whitespace and formatting like newlines count as tokens, so copying code with lots of indentation can use more tokens than you expect.
Frequently Asked Questions
How many tokens are in a typical English word?
On average, one English word is about 1.33 tokens. So 100 words is roughly 133 tokens, and 750 words is about 1,000 tokens. This is a rough estimate; short common words are often one token, while longer or rarer words can be two or more.
Do spaces and punctuation count as tokens?
Yes, spaces and punctuation are usually part of the tokenization process. They are often attached to the preceding word, so "hello," might be one token including the comma. Standalone symbols like emojis can be one or more tokens each.
What happens when I exceed the token limit?
You get an error message from the API, and the request is not processed. You need to reduce the input length, lower the max output tokens, or use a model with a larger context window. In chat interfaces, the application may automatically truncate older messages to stay under the limit.
Can I increase the token limit?
No, the token limit is a fixed property of the model. You cannot increase it, but you can choose a different model with a larger context window. For example, if you are using a 4K-token model and need more space, switch to an 8K or 16K version if available.
How do I check the token count of my text?
Most LLM providers offer a tokenizer tool on their website where you can paste text and see the exact token count. You can also use the API's token counting endpoint, or estimate manually by multiplying words by 1.33.
Why do output tokens cost more than input tokens?
Generating text is computationally more intensive than reading it because the model must predict each token sequentially, using the previous tokens as context. This requires more memory and processing, so providers charge a higher rate for output tokens.