Context Window Calculator
Paste your prompt, pick a model, and see how much of its context window you use and how many tokens remain for the reply.
- Free
- No account
- Runs in your browser
- Nothing uploaded
Paste a prompt above to see how much of Claude Opus 5’s 1,000,000-token window it uses.
Runs entirely in your browser — your input is never uploaded, logged, or stored.Privacy policy
What is Context Window Calculator?
A context window is the total token budget a model has for one request — your prompt and the model's reply share it. This calculator takes the text you plan to send, counts it, and answers two questions a raw token count cannot: what share of the window the prompt occupies, and how many tokens are actually left for the response.
Those are different questions because two separate ceilings apply, and the smaller one always wins. A model may advertise a one-million-token context window and a 128,000-token maximum response, but if your prompt already fills the window there is no room for a reply of any length. The reverse also catches people out: Claude Haiku 4.5 can return up to 64,000 tokens, yet a 195,000-token prompt leaves only 5,000 tokens of window for it to write into. The tool reports the real figure — the lower of the two — rather than the number on the spec sheet.
It is for anyone sizing prompts against a model before shipping: long-document summarisation, large code-file review, RAG pipelines stuffing retrieved chunks into a prompt, or agent loops where conversation history grows every turn. Read the output as a planning estimate, not a billing figure — the methodology section below explains exactly how accurate each number is and where to get an exact one.
Prompt tokens are counted one of two ways, depending on the model. For OpenAI models the tool runs o200k_base, the newest published tiktoken encoding. For Claude and Gemini models it uses the ~4-characters-per-token approximation that Anthropic and Google both publish as guidance, because neither vendor publishes an exact tokenizer for their current models.
Room for the reply is then the lower of two ceilings: the space left in the context window after the prompt (context window − prompt tokens), and the model's own maximum output tokens. Percentage used is prompt tokens ÷ context window. A prompt 'fits' when prompt tokens plus the output you reserved stay within the context window.
| Model | Context window | Max response | How tokens are counted here | |
|---|---|---|---|---|
| GPT-5.6 Sol / Terra / Luna | 1,050,000 | 128,000 | o200k_base (proxy) | |
| GPT-5.2 | 400,000 | 128,000 | o200k_base (proxy) | |
| Claude Opus 5 | 1,000,000 | 128,000 | ~4 chars/token estimate | |
| Claude Sonnet 5 | 1,000,000 | 128,000 | ~4 chars/token estimate | |
| Claude Haiku 4.5 | 200,000 | 64,000 | ~4 chars/token estimate | |
| Gemini 3.6 Flash | 1,048,576 | 65,536 | ~4 chars/token estimate | |
| Gemini 3.5 Flash | 1,048,576 | 65,536 | ~4 chars/token estimate | |
| Gemini 3.1 Pro | 1,048,576 | 65,536 | ~4 chars/token estimate |
Worked examples
- 'The quick brown fox jumps over the lazy dog.' against GPT-5.2 → 10 tokens of a 400,000-token window (0%), leaving the full 128,000-token maximum response available.
- The same sentence against Claude Haiku 4.5 → 11 tokens. The count differs from GPT because Haiku uses the character-based estimate rather than a published tokenizer.
- A 200,000-character document against Claude Haiku 4.5 → 50,000 estimated tokens, 25% of its 200,000-token window, with the full 64,000-token response ceiling still available.
- The same 200,000-character document against Gemini 3.6 Flash → the same 50,000 tokens, but only 4.8% of its 1,048,576-token window, and 65,536 tokens available for the reply.
- A 780,000-character document against Claude Haiku 4.5 → 195,000 estimated tokens, 97.5% of the window. Haiku's maximum response is 64,000 tokens, but only 5,000 tokens of window remain, so reserving 8,000 does not fit.
How to use Context Window Calculator
- Paste the complete prompt you plan to send — system prompt, few-shot examples, retrieved context, and user message together, not just one part.
- Select the model you are targeting.
- Set how many tokens you want to reserve for the reply.
- Read the verdict: the percentage of the window your prompt uses, and the tokens genuinely available for the response.
- If it does not fit, trim the prompt, reserve fewer output tokens, or move to a model with a larger window.
Common errors
- "Paste your prompt first — the input is empty." — the text box is empty or contains only whitespace. Paste the prompt you intend to send.
- "Claude Haiku 4.5 caps a single response at 64,000 tokens, so it cannot reserve 70,000." — you asked to reserve more output than the model can produce in one response. Lower the reserved figure, or split the work across more than one request.
- "Reserved output tokens must be a whole number of 0 or more." — the reserved output field is negative or fractional. Tokens are counted in whole units.
- The result says it does not fit even though the prompt is well under the context window — check the reserved output tokens. Prompt and reply share one budget, so a large reservation can push a comfortable prompt over the limit.
- Available output is far below the model's advertised maximum — this is correct, not a bug. Once the prompt fills most of the window, the remaining space becomes the binding limit rather than the model's response ceiling.
- The count differs from your provider's billing figure — expected. These are planning estimates from published proxies and approximations; see the methodology note for where to get an exact count.
FAQ
What is a context window in an LLM?
It is the total number of tokens a model can consider in one request, covering both your prompt and the reply it generates. The two share a single budget, so every token of prompt is one fewer token available for the response.
Why does my prompt fit but the tool says there is no room for a reply?
Because the prompt and the reply come out of the same budget. A prompt at 99% of the context window fits on its own, but leaves only 1% of the window for the model to write into — often far less than the reply you need.
How accurate is the token count in this calculator?
It is a planning estimate, never an exact figure, and the tool labels which method it used. OpenAI models are counted with o200k_base, the newest published tiktoken encoding, which is close but not guaranteed to match the current models. Claude and Gemini use the ~4-characters-per-token approximation their vendors publish, because neither releases an exact tokenizer for their current models. For a number you can bill against, use Anthropic's count_tokens endpoint or the usage figures returned on a real API call.
Why do Claude and GPT give different token counts for identical text?
Each model family uses a different tokenizer with its own vocabulary, so the same sentence is split into different sub-word units. In this tool the gap is wider still, because OpenAI models are counted with a real encoding while Claude and Gemini use a character-based approximation.
Does a bigger context window always mean I can send a bigger prompt?
For the prompt itself, yes — but the maximum response length is a separate limit that does not scale with the window. Gemini 3.6 Flash has a 1,048,576-token window but caps replies at 65,536 tokens, so a very large window does not buy you a longer answer.
How many tokens should I reserve for the reply?
Reserve slightly more than the longest response you expect. If you are unsure, start from the length of a typical good answer in tokens and add headroom — running out of window mid-reply truncates the response rather than returning an error you can act on.
Are these context window figures current?
They were read from OpenAI's, Anthropic's, and Google's own documentation on 7 August 2026, and the date is shown on the page. Providers change limits and ship new models without notice, so check the provider's documentation before relying on a figure for anything critical.
Related tools
Prefer AllUtil on Google
One click adds AllUtil to your Google preferences. You'll see our tools highlighted with a Preferred badge in Search and AI answers.