Context window calculator

Enter the window size, what your prompt already uses, and how much room the answer needs. The calculator reserves the answer first, then reports what is left.

Room leftEnter values to calculate

The answer needs room too

A context window holds the prompt and the reply together. Filling it to the brim with input leaves nothing for output, and the failure shows up as a reply that stops mid-sentence rather than as a clear error. That is why the reserved-output field is not optional here: the fit test is prompt plus reserve against the window, not prompt against the window.

How much to reserve is a judgement about your task. A classification that answers with one word needs almost nothing; a rewrite that returns the document needs at least as many tokens as the document.

What fills a window besides your question

A system prompt is counted on every call. So is the conversation history you resend, the tool definitions you attach, and any documents you paste in. A long chat grows its own input cost with every turn, which is the usual reason a window that was comfortable in testing is tight in production.

Frequently asked questions

Is the context window the same as the output limit?

No. The window is the total the model can hold at once. Many models also cap a single reply well below that total, so a window with 100,000 tokens free does not mean you can ask for a 100,000-token answer.

What happens if I exceed the window?

It depends on the API: a plain completion call is usually rejected outright, while an interface that manages a conversation for you may drop the oldest part of it instead. Both are worse than noticing beforehand, and the second is worse than the first, because the call succeeds while quietly forgetting what you told it.

Does a bigger window cost more?

Only through the tokens you actually put in it. The window is a ceiling, not a purchase; you are billed for the tokens sent and received. A long prompt is expensive because it is long, not because the model could have held more.

More tools

API cost

Cost of a call and a run from prices you enter.

Tokens & words

Estimate tokens from words at an adjustable ratio.