---
title: "Context window calculator: will my text fit? | BroadRouter"
description: "Paste text or load a file and see whether it fits each model's context window, how much room is left for the answer, and what filling the window costs."
url: https://broadrouter.com/tools/context-window-calculator/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Context window calculator

Updated 2026-11-15

**In short:** A context window is the most tokens a model handles in one request, prompt and answer together. Your text fits if its prompt tokens plus the output you reserve stay within the window. BroadNet chat models offer 32,768 to 1,048,576 tokens. Paste text or open files to see the share used, room left and cost per model.

Free, no sign-up, runs in your browser: nothing you type is sent anywhere.

Open filesor drop them here · read locally, never uploaded

Text\## Authentication Send your API key in the Authorization header as a bearer token. Keys are created in the dashboard and can be restricted to a list of IP addresses. A request without a valid key returns HTTP 401 with an error object. ## Rate limits Pay-as-you-go keys allow a fixed number of requests per minute and a fixed number of requests in flight. When you exceed either limit the API returns HTTP 429 and a Retry-After header. Retry with exponential backoff and jitter: wait 1 s, then 2 s, then 4 s, and give up after five attempts. ## Streaming Set "stream": true to receive server-sent events. Each event carries a delta with the next piece of the answer. The final event is "data: \[DONE\]". If you need token usage while streaming, set stream\_options.include\_usage to true; the usage object arrives in the last chunk before \[DONE\]. ## Errors | Status | Meaning | What to do | |---|---|---| | 400 | Invalid request body | Fix the JSON or the parameters | | 401 | Missing or invalid key | Check the Authorization header | | 413 | Request too large | Shorten the prompt or the file | | 429 | Rate limit | Back off and retry | | 500 | Server error | Retry once, then contact support | Timeouts should be set per request. For long reasoning answers, allow at least 120 seconds before the client gives up.

Reserve for output, tokens

Room left = context window − prompt tokens. Cost = prompt tokens × input price per 1M; the reserved output, if fully used, adds the output cost shown. ≈ marks an estimate until that model's tokenizer is loaded.

[Create an account ($5 starting credit)](https://inference.broadnet.ai/?utm_source=broadrouter&utm_medium=referral&utm_campaign=tools-context-window-calculator&utm_content=tool) ·

[Report a wrong price or number](mailto:info@broadnet.ai?subject=Wrong%20price%20or%20number%20on%20Context%20window%20calculator&body=Page%3A%20https%3A%2F%2Fbroadrouter.com%2Ftools%2Fcontext-window-calculator%2F%0A%0AWhat%20looks%20wrong%20(model%2C%20figure%20shown%2C%20correct%20figure%20and%20a%20source%20link%20if%20you%20have%20one)%3A%0A) (email to info@broadnet.ai, with this page's link and your inputs filled in).

## How it works

1.  Paste text, or open one or more local files (.txt, .md, .json, .csv or code). Nothing is uploaded.
2.  Set how many tokens to reserve for the answer, including any reasoning.
3.  Read each model's row: tokens, share of the context window used, room left for output and the cost to send the text once.
4.  Load the real tokenizers to replace estimates marked ≈ with real counts.

## Context windows at a glance

How much English prose each window holds, measured with each model's own tokenizer at 500 words per page:

| Model | Context window | ≈ English words | ≈ Pages | Cost to fill once |
| --- | --- | --- | --- | --- |
| [DeepSeek V4.1 Flash](https://broadrouter.com/models/deepseek-v4.1-flash/) | 1,048,576 tokens | 823,135.639 | 1,646.271 | $0.184 |
| [GLM 5.3](https://broadrouter.com/models/glm-5.3/) | 1,048,576 tokens | 812,886.899 | 1,625.774 | $0.818 |
| [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/) | 262,144 tokens | 198,665.184 | 397.33 | $0.0459 |
| [BroadNet Gemma 4 VL 26B](https://broadrouter.com/models/gemma-4-vl-26b/) | 32,768 tokens | 25,220.913 | 50.442 | $0.0033 |

Words per token from our English prose sample (1183 words) measured 2026-11-15; see the [tokens to words converter](https://broadrouter.com/tools/tokens-to-words/) for other content. Prices synced 2026-11-14.

## The formula

```
room left for output = context window − prompt tokens
fits                 = prompt tokens + reserved output ≤ context window
cost to send once    = prompt tokens × input price per 1M ÷ 1,000,000
```

Worked example: a 300-page English report is about 197,928.994 tokens with the Qwen tokenizer. It fits [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/)'s 262,144-token window with 64,215.006 tokens to spare, and costs $0.0346 to send once. It would not fit BroadNet Gemma 4 VL 26B's 32,768-token window; split it, or summarise it in parts.

## When it doesn't fit

-   Move to a longer window: DeepSeek V4.1 Flash and GLM 5.3 take 1,048,576 tokens.
-   Send only the relevant parts: retrieve the sections that answer the question instead of the whole file.
-   Trim history in long chats: keep the system prompt and the latest turns.
-   Remove noise: minify JSON, drop base64 blobs, logs and lockfiles from code dumps.

## Questions

### What is a context window?

The maximum number of tokens a model can handle in one request, counting the prompt (system prompt, history, documents) and the answer it writes together. If the prompt uses the whole window, there is no room left for output. [Context window explained](https://broadrouter.com/glossary/context-window/).

### How do I know if my document fits in the context window?

Open the file above. The calculator counts its tokens with each model's own tokenizer, then subtracts them and your reserved output from each window. A green row fits with your reserve; amber fits the prompt but leaves less room than you reserved; red does not fit.

### How many pages fit in a 1M-token context?

About 1,646.271 pages of English prose at 500 words per page, by our measurement with the DeepSeek V4.1 Flash tokenizer. Code, JSON and Arabic fit fewer pages because they need more tokens per word.

### Why reserve output tokens?

The answer shares the window with the prompt. Reasoning models also spend hidden reasoning tokens before answering, which count as output. Reserve enough for both, or a long prompt leaves the model no room to finish. [Why reasoning can empty a reply](https://broadrouter.com/guides/reasoning-tokens-empty-response/).

### Are my files uploaded?

No. Files are read in your browser with the FileReader API and tokenized locally. The only download is the public tokenizer file from Hugging Face, once.

### Does the API add tokens beyond my text?

Yes, a few. The chat template wraps each message in role markers, usually 12 to 52 tokens per request for these models, and tool definitions add more. Leave a small margin, or tick "Chat format" in the [token counter](https://broadrouter.com/tools/token-counter/) to see the exact overhead.

## Go deeper

-   [The 1M-token context window: a practical guide](https://broadrouter.com/blog/million-token-context-window-guide/)
-   [Context window](https://broadrouter.com/glossary/context-window/)
-   [max\_tokens](https://broadrouter.com/glossary/max-tokens/)
-   [Token counter with a token-by-token view](https://broadrouter.com/tools/token-counter/)
-   [Prices per model](https://broadrouter.com/pricing/)

## More free tools

-   [**LLM API cost calculator**Price a workload on every model at once, with cache hits, reasoning and a flat-plan check.](https://broadrouter.com/tools/llm-api-cost-calculator/)
-   [**Speech-to-text cost calculator**Hours, calls or voice notes to a monthly transcription bill, against your current provider.](https://broadrouter.com/tools/speech-to-text-cost-calculator/)
-   [**LLM token counter**Exact token counts with each model's real tokenizer, with a token view and cost.](https://broadrouter.com/tools/token-counter/)
-   [**Arabic token counter**Arabic vs English token counts per tokenizer: the "Arabic tax" in tokens and money.](https://broadrouter.com/tools/arabic-token-counter/)
-   [**Tokens to words converter**Tokens ↔ words ↔ characters ↔ pages, by language and content type.](https://broadrouter.com/tools/tokens-to-words/)
-   [**Flat-rate vs per-token LLM cost calculator**Break-even between an unlimited plan and paying per token, per agent.](https://broadrouter.com/tools/flat-rate-vs-per-token-calculator/)
-   [**Prompt caching savings calculator**Bill with and without caching, by prefix share and hit rate.](https://broadrouter.com/tools/prompt-caching-calculator/)
-   [**Image token calculator**Tokens and cost per image under each model's documented rule. Drop an image; nothing is uploaded.](https://broadrouter.com/tools/image-token-calculator/)
-   [**Self-hosting vs API cost calculator**GPU rental against your current API and BroadNet per-token and flat-plan prices: cost per 1M tokens and break-even volume.](https://broadrouter.com/tools/self-hosting-vs-api-calculator/)
-   [**Embedding cost calculator**Index, update and query costs for a corpus at OpenAI, Google, Voyage, Mistral and Jina list prices.](https://broadrouter.com/tools/embedding-cost-calculator/)
-   [**LLM rate limit and concurrency calculator**Which limit binds first: RPM, TPM or concurrency, with Little's law.](https://broadrouter.com/tools/llm-rate-limit-calculator/)
-   [**JSON schema generator for LLM structured output**Sample JSON to strict schema, Pydantic, Zod and a ready request.](https://broadrouter.com/tools/json-schema-generator/)
-   [**OpenAI-compatible API request builder**One request, copied as curl, Python, Node or the OpenAI SDKs.](https://broadrouter.com/tools/api-request-builder/)
-   [**Audio file splitter for speech-to-text limits**Chunk count, overlap and copy-ready ffmpeg commands to fit a transcription file-size limit.](https://broadrouter.com/tools/audio-splitter-ffmpeg/)
-   [**Agent run cost estimator**Context growth per step, total tokens and cost of one agent run, with a DeepSeek session comparison.](https://broadrouter.com/tools/agent-run-cost-estimator/)
-   [**OpenAI to BroadNet migration helper**Paste OpenAI SDK code; get base URL, key and model edits, a diff and the checks that remain.](https://broadrouter.com/tools/openai-to-broadnet-migration/)
-   [**Arabic text normalizer**Tashkeel, tatweel, alef, ya, ta marbuta, digits and invisible characters, with a matching Python function.](https://broadrouter.com/tools/arabic-text-normalizer/)
-   [**RAG chunking calculator**Chunks, embedding tokens, input per query, context check and monthly LLM cost for a RAG pipeline.](https://broadrouter.com/tools/rag-chunking-calculator/)
-   [**max\_tokens calculator for reasoning models**Answer length + reasoning budget + margin = a max\_tokens that does not cut the answer off.](https://broadrouter.com/tools/reasoning-token-budget/)
-   [**LLM batch job planner**Run time, binding limit, cost per model and the flat sessions needed to finish a big job by a deadline.](https://broadrouter.com/tools/llm-batch-job-planner/)
-   [**LLM JSON output validator**Parse errors by line and column, safe repairs, cut-off detection and JSON Schema checks for model output.](https://broadrouter.com/tools/llm-json-output-validator/)
-   [**Prompt token diff**Two prompt versions side by side: changed lines, exact token delta and the monthly cost difference.](https://broadrouter.com/tools/prompt-token-diff/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=tools-context-window-calculator&utm_content=page-cta) ·

**Sources**

-   [BroadNet Inference machine-readable prices (pricing.json)](https://inference.broadnet.ai/pricing.json?utm_source=broadrouter&utm_medium=referral&utm_campaign=tools-context-window-calculator&utm_content=sources)
