LLM context planning
Plan your AI context budget.
Plan token budgets for LLM requests, document chunks, and conversation history. Check what fits and reserve space for the answer. No model calls.
View calculation ↓Give every token a place.
Use a custom capacity from your model documentation. The example is synthetic.
Enter counts from your tokenizer or usage report. Character estimates are not exact token counts.
Your context, accounted for.
Custom limitsWindow allocation
32,000 / 32,000 tokens- Instructions
- 2,000
- History
- 4,000
- Tools & overhead
- 1,000
- Source text
- 20,000
- Output reserve
- 4,000
- Safety margin
- 1,000
Output maximum unknown: output-limit check is not performed.
A planning bound, not an API preflight guarantee. Use counts from the correct model tokenizer or provider usage report; message wrappers, reasoning and tools may need additional reserve.
A small change. A clear difference.
Save a scenario above, then adjust a count to see the difference. Snapshots stay in this tab.
How to plan an AI context budget
A context window must hold the content in your request and the space reserved for the answer. This calculator adds your token allocations and shows the remaining capacity or overflow.
- Enter the context capacity from your model documentation and its output limit, if known.
- Allocate tokens to instructions, history, tools, source text, output and a safety margin.
- Check the result, save scenario A, and adjust your counts to compare a second plan.
Worked example
With 32,000 tokens of capacity and 12,000 allocated to everything except source text, the available source budget is 20,000 tokens.
This is a manual planning tool, not a tokenizer or an API preflight check. Model-specific wrappers, tools and reasoning may require additional reserve. Read the formulas and sources.