RAG Chunking Calculator (Chunks, Overlap and Embedding Cost)
Enter your corpus size and chunk settings to plan a RAG index.
Your numbers
Your results
RAG Chunking Calculator (Chunks, Overlap and Embedding Cost) by TheCalcTools
How the RAG Chunking Calculator (Chunks, Overlap and Embedding Cost) works
Each new chunk starts (chunk size − overlap) tokens after the previous one, so a document of T tokens makes about ⌈(T − overlap) ÷ (chunk − overlap)⌉ chunks. Overlap keeps sentences that cross a boundary searchable.
Embedding cost depends on the total tokens embedded, including the repeated overlap. Retrieved context is the chunks per question times the chunk size, which becomes input tokens for the language model.
The formula
Worked example
Using the default values shown in the calculator:
| Number of documents | 500 |
|---|---|
| Average tokens per document | 4000 |
| Chunk size (tokens) | 512 |
| Overlap (tokens) | 64 |
| Embedding price per 1M tokens | $0.1 |
| Chunks retrieved per question | 8 |
- A 4,000-token document in 512-token chunks with 64 overlap: ⌈3,936 ÷ 448⌉ = 9 chunks.
- 500 documents → 4,500 chunks; retrieving 8 adds 4,096 tokens to each prompt.
Result:
| Total chunks | 4,500 |
|---|---|
| Chunks per document | 9 |
| Tokens to embed (millions) | 2.29 |
| One-off embedding cost | $0.23 |
| Retrieved context per question (tokens) | 4,096 |
Frequently asked questions
What chunk size should I use?
Many systems use 256 to 1,024 tokens with 10 to 20% overlap. Smaller chunks retrieve precisely; larger chunks keep more context. Test on your own questions.
Sources and further reading
Related calculators
More in AI & Computing · All calculators
This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.
