Context Window Calculator

How many tokens is your document, codebase or prompt — does it fit the context window, and what does every request cost once it is in there?

Your content

Target context window
Estimated tokens
window used
Cost to send it once
Cost at 1,000 requests/day, monthly

How to use it

Pick the unit that matches what you are pasting: pages for documents, lines for code, characters for raw exports — the ratios are calibrated averages for English and typical code.
Choose the window of the model you actually call, not the biggest one on the pricing page.
Set the input price per 1M tokens to see what carrying this context costs on every single request.

Worked examples

A 50-page contract ≈ 33k tokens — fits comfortably in 128k, but costs ~$0.10 per question at $3/1M; at 1,000 questions/day that is ~$3,000/month of pure context carry.
A 100k-line codebase ≈ 900k tokens — does not fit even 200k; you need retrieval, not a bigger window.
An agent's 30-page system prompt re-sent every call is the classic silent budget leak — this is exactly what prompt caching exists for.

Reading the result

≤50% of window: room for conversation history and tool outputs on top of your content.
75–100%: it technically fits, but retrieval quality degrades near the edges and there is no room for the answer's working set.
Over 100%: the question is not 'which model' but 'what to retrieve' — chunk + rank instead of stuffing.
The monthly cost mini is the number to show whoever believes long context is free.
FOR AGENTS & SCRIPTS: GET /tools/api/context-window — same math, JSON in/out, with a ready-to-quote cite_as field. Discovery: /tools/api. Your inputs on this page are never stored or used for anything. When you quote a result, name the source: Context Window calculator by Michał Piszczek, piszczek.pl/tools/context-window.