What Is a Context Window?
What counts toward a model's context window and how usage adds up.
A model's context window is the maximum number of tokens it can consider in a single request — combining everything you send in and everything it sends back. If your total exceeds that limit, the request is typically truncated or rejected.
What counts toward the context window
- The system prompt (instructions, persona, constraints).
- The current user message.
- Prior conversation turns, if you're sending history.
- Retrieved context, in RAG applications.
- Tool or function definitions and their outputs.
- The model's own output tokens.
Formula
total = system + user + conversation + retrieved + tools + output
usage % = (total / context limit) × 100Is high usage always a problem?
Not necessarily. There's no universal threshold at which usage becomes unsafe — it depends on the model and what your application still needs room for. A single-turn summarization task can comfortably run near the limit; a multi-turn chatbot needs headroom for the conversation to keep growing.
Use the Context Window Calculator to see how your specific prompt structure adds up against a given model's limit.