Context Window Planner
Add up system, docs, history and reply — see what fits the window.
A model's context window is one shared token budget for everything you send and everything it says back, so it's easy to overflow without noticing. This context window calculator lays out that budget as a live stacked bar: enter your system prompt, retrieved documents, conversation history and the room you want to leave for the reply, pick a model, and see how full the window gets. Use it as an llm context size planner to set a prompt context budget before you build, and it warns you the moment the pieces don't fit.
What's in the window
Free space left
114,900
10.2% of 128,000 tokens used
- System prompt600
- Documents / RAG8,000
- Chat history3,000
- Reserved reply1,500
- Prompt tokens
- 11,600
- Reply reserve
- 1,500
- Total used
- 13,100
- Free space
- 114,900
Everything fits, with room to spare. Remember you still pay per token for the whole prompt, so a big window is a ceiling, not a target. Token counts are your own estimates; the real split depends on the model's tokenizer.
How it works
- 1
Pick the model
Choose the model you're targeting. Its context window — 128K for GPT-4o, 200K for Claude, up to 2M for Gemini — sets the size of the bar everything has to fit inside.
- 2
Enter each part
Put in token counts for the system prompt, documents or retrieved chunks, conversation history, and the reply you want to reserve room for. Each part fills its own band on the bar.
- 3
Watch it fill
The stacked bar shows how much of the window each piece takes and how much is free. Go over the limit and the result turns red so you know to trim before you hit a truncation error.
Instant & 100% private — nothing is uploaded
Every calculation runs locally in your browser. The prompts, token counts and numbers you enter stay on your own device and are never sent to a server — nothing is stored, logged or shared.
Frequently asked questions
- What counts toward the context window?
- Everything in a single call: the system prompt, any documents or retrieved chunks you paste in, the conversation history you resend, and the tokens the model generates as its reply. They all draw on the same budget, which is why long histories and big documents crowd out the answer.
- How do I fit tokens in a context window that's too small?
- Trim or summarize old conversation turns instead of resending them verbatim, retrieve fewer or shorter document chunks, tighten the system prompt, and cap the reply length. If it still won't fit, move to a model with a larger window.
- Why reserve tokens for the reply?
- The window has to hold your prompt and the model's output together. If your prompt fills almost the whole window, there's no room left for a full answer and the reply gets cut off. Reserving a reply budget up front keeps space for the model to finish.
- How do I get the token counts to enter?
- Use a token counter on samples of your system prompt, a typical document chunk and a few turns of history, then enter those figures. The counts are estimates that vary by tokenizer, so leave a little headroom rather than filling the window to the last token.
Important
For planning and estimates only. Prices come from a published rate table dated on the page; providers change pricing without notice, and token counts here are approximations. Confirm against the provider’s own pricing before you budget or commit.
More tools
More from the Hivly network
Free sister tools on our other sites.