What is a context window?
A context window is the maximum amount of text a language model can consider at one time, measured in tokens. Everything counts toward it: the system prompt, the conversation so far, any documents you paste, and the reply the model is about to write. Exceed the window and the request fails or the oldest content is quietly dropped.
Why the limit exists
Transformers attend to every token relative to every other token, so cost and memory grow with the square of the input length. That is why windows are finite and why bigger windows cost more. Modern models range from a few thousand tokens to well over a million.
Typical context sizes
| Model family | Approximate window |
|---|---|
| GPT-3.5 era | 16K tokens |
| GPT-4o / Llama 3.1 | 128K tokens |
| Claude 3.5 | 200K tokens |
| Gemini 1.5 Pro | 1M to 2M tokens |
How to check your prompt
Because a token is roughly four English characters, you can estimate the size of any prompt by dividing its character count by four. The LLM Context Window Checker does this and shows the percentage of each model's window that your text would use, flagging anything that is too long.
Leave room for the answer
The reply shares the same window as your input. If you fill the window completely, the model has no space to respond. Budget the expected output length and keep your input comfortably below the limit.
When your text is too long
- Summarise or truncate the oldest messages.
- Retrieve only the most relevant passages instead of whole documents.
- Use a model with a larger window for the few requests that need it.
- Split the task into smaller steps.
Estimate the token count first, then price the tokens with the AI API Cost Calculator, because a bigger window usually means a higher price per token.