AI Economics Tools // cost
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
Estimated tokens
—
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
PUT THIS CALCULATOR ON YOUR OWN PAGE:
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 — or take the DOI and BibTeX from /cite.PUT THIS CALCULATOR ON YOUR OWN PAGE:
<iframe src="https://piszczek.pl/tools/context-window/embed" width="100%" height="900" style="border:0" loading="lazy" title="Context Window calculator"></iframe> — free, no tracking, keeps the byline.Questions and answers
How many tokens is a page of text?
Roughly 665 tokens per page of prose. Fifty pages come to about 33,250 tokens, which is around 26% of a 128,000-token context window.
Is full context cheaper than RAG?
Fitting is the wrong question; carrying is the expensive one. Holding 33,250 tokens of context on every request at 1,000 requests a day costs roughly 3,000 dollars a month at 3 dollars per million input tokens. That figure, not the window size, decides RAG versus full context.