LLM Context Window Calculator

Check whether your prompt, document or book fits in a model's context window. Enter tokens, words or pages, reserve room for the reply, and see which models fit, how much space is left and the KV cache memory that context needs on open-weight models.

Your content

Sets the tokens per word. Ignored when the unit is tokens.

500 is a single-spaced page, 250 is double-spaced.

The window holds the prompt and the answer together, so leave room for the output. Reasoning models count thinking tokens too.

Does it fit?

Your content is about 100,000 tokens (about 150 pages). With 4,096 reserved for the reply that is 104,096 tokens in total. The smallest listed window that holds it is Llama 3.1 8B (131,072 tokens).

ModelWindowUsedTokens leftFits?
GPT-6.1 TerraOpenAI1,050,0009.9%945,904 (about 1,419 pages)Yes
Claude Sonnet 5.5Anthropic1,000,00010.4%895,904 (about 1,344 pages)Yes
Gemini 3.1 ProGoogle1,048,5769.9%944,480 (about 1,417 pages)Yes
Llama 3.1 8BOpen weights131,07279.4%26,976 (about 40 pages)Yes
Llama 3.1 70BOpen weights131,07279.4%26,976 (about 40 pages)Yes
Llama 3.1 405BOpen weights131,07279.4%26,976 (about 40 pages)Yes
Mistral 7B v0.3Open weights32,768318%over by 71,328No
Qwen 2.5 7BOpen weights32,768318%over by 71,328No
Qwen 2.5 32BOpen weights32,768318%over by 71,328No
Qwen 2.5 72BOpen weights32,768318%over by 71,328No
Gemma 2 9BOpen weights8,1921271%over by 95,904No
Gemma 2 27BOpen weights8,1921271%over by 95,904No
DeepSeek R1 Distill Llama 8BOpen weights131,07279.4%26,976 (about 40 pages)Yes
DeepSeek R1 Distill Qwen 32BOpen weights131,07279.4%26,976 (about 40 pages)Yes

Hosted limits (checked November 23, 2026) come from the provider pages: GPT-6.1 Terra, Claude Sonnet 5.5, Gemini 3.1 Pro. Providers change limits and some charge more above a size threshold, so confirm before you build on a number.

Memory for that context (open-weight models)

Running a model locally, the KV cache grows with every token in the window. For 104,096 tokens at FP16, batch 1:

ModelKV cacheNote
Llama 3.1 8B12.7 GB
Llama 3.1 70B31.8 GB
Llama 3.1 405B50.0 GB
Mistral 7B v0.312.7 GBExceeds the 32,768-token window
Qwen 2.5 7B5.56 GBExceeds the 32,768-token window
Qwen 2.5 32B25.4 GBExceeds the 32,768-token window
Qwen 2.5 72B31.8 GBExceeds the 32,768-token window
Gemma 2 9B33.4 GBExceeds the 8,192-token window
Gemma 2 27B36.5 GBExceeds the 8,192-token window
DeepSeek R1 Distill Llama 8B12.7 GB
DeepSeek R1 Distill Qwen 32B25.4 GB

This is the cache only, on top of the model weights. Add weights and overhead and check GPU fit with the LLM RAM and VRAM calculator, or change precision, batch size and attention type in the KV cache calculator.

How to check if your text fits a context window

  1. Enter the size of your content and pick its unit. If you already have an exact token count, choose Tokens. If not, use words, pages or books and pick the language.
  2. Set how many tokens to reserve for the reply. The context window covers the prompt and the output together.
  3. Read the table: models marked Yes can take the prompt and the reply. Tokens left shows the headroom, with the same amount expressed in pages.
  4. For a model you run yourself, check the KV cache table, then add the weights with the RAM calculator.

How it is calculated

  • Fits when prompt tokens + reserved output tokens ≤ the context window. Anything over is shown as the number of tokens to cut.
  • Words and pages to tokens use about 1.33 tokens per English word (0.75 words per token) and the per-language ratios from the tokens to words converter. A page is 500 words by default, a book 80,000 words (about 107,000 tokens). These are estimates, so for exact counts use a tokenizer.
  • KV cache = 2 × layers × KV heads × head dimension × 2 bytes (FP16) × tokens, from each model's config.json.
  • Open-weight windows are the maximum position length in the model config. Qwen 2.5 is 32,768 natively and reaches 131,072 only with YaRN scaling enabled.

Worked example

A 300-page contract at 500 words a page is 150,000 words, about 200,000 tokens. With 4,096 reserved for the answer it needs roughly 204,000 tokens: too big for the 131,072-token Llama 3.1 models, fine for the 1M-token hosted models at about 20% of the window.

For an exact token count of your own text and the API price, use the AI tokens calculator.

Updated November 19, 2026. Not financial advice. This calculator is for education and rough estimates only. It relies on simplified models and your inputs, ignores taxes and many real-world costs, and past or modelled results do not guarantee future outcomes. Consult a licensed professional before making financial decisions.

See also

Frequently Asked Questions (FAQ)

What is a context window?

The context window is the maximum number of tokens a model can handle in one request. It holds everything together: your instructions, any documents or chat history you send, and the reply the model writes. If the total goes over the limit, the request fails or older content is dropped.

How many pages fit in a 128K or 1M context window?

At about 1.33 tokens per English word and 500 words per page, a page is roughly 667 tokens. A 128K (131,072-token) window holds about 196 pages and a 1M window about 1,500 pages, before leaving room for the reply. Double-spaced pages of 250 words are half the size, so twice as many fit.

Does the context window include the output?

Yes. Input and output share the window, so a 200,000-token prompt in a 200,000-token window leaves nothing for an answer. Many models also cap the reply separately, for example 64K to 128K tokens, and reasoning models count their thinking tokens against the window.

How do I convert words or pages to tokens?

For English, multiply words by about 1.33, or divide tokens by 0.75 to get words. Other languages use more tokens per word: about 1.5 for Spanish, 1.7 for German and 2.5 for Turkish. This calculator does the conversion for you. For an exact count of your own text, use the AI tokens calculator.

Does a bigger context window use more memory?

On models you host yourself, yes. The KV cache grows linearly with the number of tokens: Llama 3.1 8B needs 128 KiB per token at FP16, so 8,192 tokens take 1 GiB and a full 131,072-token window takes 16 GiB, on top of the weights. Hosted APIs handle this for you, but long prompts usually cost more and respond more slowly.

Why does my model fail below its advertised context length?

Common reasons: the reply budget plus prompt is over the limit; the server is configured with a smaller context than the model supports (many local runtimes default to 2K to 8K tokens); there is not enough GPU memory for the KV cache; or the model only reaches its long context with a scaling setting such as YaRN turned on.

My text does not fit. What can I do?

Trim the input, summarize older parts, split the document into chunks and process each one, or use retrieval (RAG) so only the relevant passages are sent. You can also move to a model with a larger window. Chunk size and embedding cost can be estimated with the RAG chunking calculator.

Are the model limits here up to date?

The hosted model limits were checked on the date shown under the table, with links to each provider page. Providers change limits, offer larger beta windows and sometimes charge more above a size threshold, so confirm the number in the provider documentation before you rely on it.

Is a longer context always better?

Not always. Models tend to use information in the middle of a very long prompt less reliably, cost grows with every input token, and latency rises with prompt length. Sending only what the model needs is usually cheaper and often more accurate than filling the window.