Part of the AI & Machine Learning suite · 36 calculators

Context Window Calculator

Whether a system prompt, a set of documents, the conversation history and room for the answer fit inside a model’s context window — how many documents fit, and the input cost of each call.

Everything the model sees counts against one limit: the system prompt, every document you attach, the whole conversation so far, and the space you must leave for the reply.

Results update as you type
Results
Context used
97.5 thousand of 128 thousand (76%)
Fits?
Most documents that fit
Input cost per call
Where the tokens go
Reviewed September 2026. Model arithmetic is the same everywhere: the same formulas in every market, in your own currency. Australia's AI Ethics Principles are voluntary; cost and sizing arithmetic carries no regulatory requirement.
No account required · Google Analytics off unless allowedCalculator arithmetic runs in your browserResults update as you type
All calculations run 100% in your browser. The calculator code does not submit your figures to GlobalCalc to obtain a result.
About context window

How the context window calculator works

Everything the model sees counts against one limit: the system prompt, every document you attach, the whole conversation so far, and the space you must leave for the reply. Add them up against the window; if they do not fit, the calculator says how many documents do. Each call pays for all the input tokens again, so a long system prompt or history multiplies cost across a conversation — which is what prompt caching is for.

Formula: used = system + docs × tokens per doc + history + reserved output; fits if used ≤ window

Worked examples

InputsContext usedNote
128k window, ten 8k documents, 12k history97.5 thousand of 128 thousand (76%)97.5k — fits, 13 docs at most
A 32k window with the same load97.5 thousand of 32 thousand (305%)does not fit — 1 document at most
Short prompt, no documents3.5 thousand of 8 thousand (44%)3.5k — fits

Frequently asked questions

How many tokens is a document?

About 1.3 tokens per English word, or 4 characters per token — a page of text is 500–700 tokens, a 20-page PDF 10,000–15,000. Code and non-English text run higher. Use the tokenizer of the model for exact counts.

Why reserve tokens for the answer?

Most APIs share one window between input and output: fill it with input and the reply is cut off. Reserve at least what the longest answer needs.

Does a bigger window solve it?

It fits more, at a cost: every call pays for every input token, and models attend less reliably to details buried in very long contexts. Retrieval — sending only the relevant passages — is usually cheaper and better than sending everything.

What does prompt caching change?

The system prompt and any stable prefix can be cached so repeat calls pay a fraction of the input price for them. The context still has to fit; only the cost falls. The prompt caching calculator quantifies it.

Where these figures come from

Last checked: September 2026. The relationships here are architectural, not vendor-specific: bytes per parameter follow the numeric format, KV-cache size follows the transformer definition, and token-per-word ratios come from published tokeniser behaviour.