RAG chunking calculator
Updated
In short: Chunks per document = (document tokens − overlap) ÷ (chunk size − overlap), rounded up, and each query sends the system prompt, the question and top-k × chunk size as input. 1,000 documents of 5,000 tokens in 512-token chunks with 64 overlap make 12,000 chunks, and top-5 retrieval adds 2,560 input tokens to every query.
Estimates before tax. Word-to-token ratios are averages over five real tokenizers from our open tokenizer dataset; count your own text for exact numbers. BroadNet prices synced 2026-11-14. Retrieval quality is not modelled: more or larger chunks cost more but do not guarantee better answers.
Report a wrong price or number (email to info@broadnet.ai, with this page's link and your inputs filled in).
How it works
- Enter the number of documents and the size of each in pages, words or tokens. For pages and words, pick the content type so words convert to tokens at measured ratios.
- Set chunk size and overlap in tokens, and top-k (chunks retrieved per query).
- Enter system prompt, question and answer tokens, queries per day and days per month. Pick the chat model and, optionally, your embedding provider's price per 1M tokens.
- Read the chunk count, tokens to embed, input per query, the context check and the monthly cost. Copy the link to share it.
The formulas
doc tokens = pages × words per page × tokens per word (or words × tokens per word)
chunks per doc = 1 if doc ≤ chunk, else ceil((doc − overlap) / (chunk − overlap))
tokens to embed = docs × (doc tokens + (chunks per doc − 1) × overlap)
input per query = system + question + top-k × chunk
monthly LLM cost = queries × (input × input_price + answer × output_price) / 1,000,000
context check = input per query + answer ≤ model contextWorked example
1,000 documents of 5,000 tokens, split into 512-token chunks with 64 tokens of overlap, make 12,000 chunks (12 per document) and 5,704,000 tokens to embed. With top-5, an 800-token system prompt and a 60-token question, each query sends 3,420 input tokens. At 2,000 queries a day for 30 days, answering with DeepSeek V4.1 Flash costs $48.39 a month at pay-as-you-go prices. Retrieving 70 chunks instead would need 37,100 tokens a query with the answer, more than BroadNet Gemma 4 VL 26B's 32,768-token context, which fits at most top-61 at this chunk size.
How to choose chunk size, overlap and top-k
- Chunk size: match the length of a passage that answers a typical question. FAQ entries and tickets suit small chunks; contracts and manuals suit larger ones.
- Overlap: enough to keep a sentence that crosses a boundary in one chunk. It adds embedding tokens, not query tokens.
- Top-k: the main cost lever per query. A long-context model lets you retrieve more passages; measure whether answers improve.
- Arabic text: Arabic needs more tokens per word than English, so the same number of words makes more chunks. Normalize before indexing with the Arabic text normalizer.
Questions
How many chunks will my documents make?
With fixed-size chunks, chunks per document = (document tokens − overlap) ÷ (chunk size − overlap), rounded up; a document shorter than one chunk is one chunk. Multiply by the number of documents. Splitters that cut at paragraphs or sentences make slightly more, smaller chunks.
What chunk size and overlap should I use?
There is no universal best. Start near the length of a passage that answers a typical question, with a small overlap so sentences that cross a boundary survive. Smaller chunks match narrow questions better; larger ones keep context together. Test retrieval on 50 real questions from your users and keep the setting that finds the right passage most often.
How many tokens does RAG add to each request?
Top-k × chunk size, plus the system prompt and the question. Five 512-token chunks add 2,560 input tokens to every query, so retrieval is usually most of the input bill. Lower top-k or chunk size to cut cost; raise them if answers miss information.
Does BroadNet Inference offer embeddings?
No. BroadNet's API reference lists chat completions, audio transcriptions and a model list, but no embeddings endpoint. Use any embedding provider or a self-hosted embedding model for the index, enter its price per 1M tokens here, and use BroadNet's chat models to answer from the retrieved passages. Compare embedding prices.
What if top-k × chunk size exceeds the context window?
The request fails or gets truncated. The calculator warns when the system prompt, question, retrieved chunks and reserved answer pass the chosen model's context window, and shows the largest top-k that fits.
Is RAG cheaper than putting the whole document in the prompt?
For large or many documents, yes, because each query sends only the retrieved chunks. For a small set that fits in a long context window, sending it all can be simpler and, with prompt caching, affordable. Long context vs RAG.