Context-Window Budget Visualizer
An agent's context window is a fixed token budget, and everything competes for it — the system prompt, the tool schemas, retrieved documents, the conversation history, the scratchpad, few-shot examples, guardrail text and the tokens you reserve for the output. Enter your own window size — there is no baked-in model list — size each line-item, and the tool draws the stacked budget, flags overflow and the exact overage, shows how the output reserve gets squeezed first, and projects which turn a growing history tips you over. Everything runs in your browser; the math is shown in full and nothing is uploaded.
1. Context window size
Enter the total token budget of your model's context window. There is no baked-in model list — you set the number. The chips below are editable example sizes, not claims about any specific model.
Usage summary
- System prompt
- Tool / function schemas
- Retrieved documents (RAG)
- Conversation history
- Agent scratchpad / memory
- Few-shot examples
- Safety / guardrail text
- Output reserve
2. Budget line-items
Size each part of what you put in the window. The output reserve is held back for the model's reply and is consumed first if the input crowds it out.
- 0.9%
- 2.7%
- 4.7%
- 3.1%
- 1.2%
- 1.6%
- 0.6%
- 3.1%
3. “What if history keeps growing?”
If each turn appends a fixed amount to conversation history, when does the budget overflow? This is a planning heuristic, not an exact token count.
The math (nothing hidden)
input items = 19,000
output reserve = 4,000
used = input + reserve = 23,000
headroom = window - used
= 128,000 - 23,000
= 105,000
used % = used / window = 18%Every number above is derived only from the values you entered. Token counts in practice depend on the tokenizer and the exact text; use these as planning figures.
What this tool is
- A free, fully in-browser visualizer for how an AI agent’s context window gets spent — and when it will overflow or truncate. Nothing is uploaded; there are no server calls and no accounts.
- You enter the window size yourself. There is NO baked-in vendor model list with fixed sizes — just editable example presets (8k, 32k, 128k, 200k, 1M) labelled as examples, so no number here claims to be any specific model’s real limit.
- Size each budget line-item — system prompt, tool/function schemas, retrieved documents (RAG), conversation history, agent scratchpad/memory, few-shot examples, safety/guardrail text, and an output reserve — and watch a stacked window bar show each slice, its %, the headroom left, and a clear OVERFLOW warning with the exact overage.
- The output reserve is treated honestly: it is consumed first, so when the input alone exceeds the window the tool shows how much of the reserve is squeezed and warns that the reply will be truncated.
- A “what if history keeps growing” projection tells you which turn you overflow on at N tokens/turn, the math is shown in full, and you get a base64url shareable permalink plus a Markdown export.
The window is a budget, and the output reserve is the part people forget
Most context-overflow incidents are not a surprise about the window size — they are a surprise about how much of it the input was quietly eating. Tool schemas grow every time an agent gains a capability, retrieved documents scale with how much you pull back, and conversation history grows without bound as a session runs. Add a system prompt, some few-shot examples and a block of guardrail text, and the reserve you left for the model's answer can vanish. This visualizer makes each of those slices concrete so you can see which one to cut — trim the retrieval, summarise the history, scope the tools — before a production call truncates mid-answer.
The output reserve gets its own honest treatment because it is the first thing squeezed. The window has to hold both what you send and what the model writes, so when the input alone crosses the window line there is nothing left for the reply. The tool shows exactly how many reserve tokens are consumed in that case and warns that the output will be cut short — rather than drawing a tidy bar that hides the problem. The “what if history keeps growing” projection turns that into a number you can plan against: at your tokens-per-turn estimate, it tells you the turn on which you overflow, so you know whether to add history summarisation now or later.
Frequently asked questions
What is a context-window budget?
It is the accounting of everything you put into a model’s context window on a single call, measured in tokens. The window has a fixed size, and every part of the prompt competes for it: the system prompt, the JSON schemas for the tools the agent can call, documents retrieved for RAG, the conversation history, the agent’s scratchpad or memory, few-shot examples, safety and guardrail text, and the tokens you reserve for the model’s own output. When the sum exceeds the window, something gets dropped or the reply is truncated. This tool makes that budget visible so you can see where the tokens go and when you will overflow.
Does it know my model’s real context size?
No, deliberately. There is no baked-in list of vendor models with fixed window sizes, because those numbers change and get misremembered. You enter the window size yourself. The preset chips (8k, 32k, 128k, 200k, 1M) are labelled examples of common round numbers to save typing — they are fully editable and assert nothing about any specific model. If you want an exact figure, take it from your provider’s current documentation and type it in.
Why is the output reserve “eaten first”?
Because the window has to hold both the input (everything you send) and the output (what the model writes back). You reserve space for the reply, but that reserve is the first thing squeezed when the input is too large: if your input alone already exceeds the window, there is literally no room left for the output, so the model’s answer is cut short or the call is rejected. The tool shows this explicitly — when the input exceeds the window it reports how many tokens of your reserve are consumed and warns that the reply will be truncated, rather than pretending the reserve is safe.
How accurate are the token numbers?
The arithmetic is exact — it sums exactly the token counts you enter and shows every step of the math. What it cannot do is count tokens for you: the real token count of a piece of text depends on the tokenizer and the exact content, which differ between models. So the inputs are your estimates, and the “what if history grows” projection is a planning heuristic (it assumes a fixed number of tokens is appended each turn). The tool labels the heuristic as such and never invents a token count or a model size.
Does anything leave my browser?
No. The whole tool is client-side React with inline SVG and local state. There are no network or API calls, no account and no analytics on the computation. The shareable link encodes your budget in the URL hash (base64url) so it round-trips without a server, and the Markdown export is generated and downloaded locally.