AI & Computing

RAG Chunking Calculator (Chunks, Overlap and Embedding Cost)

Enter your corpus size and chunk settings to plan a RAG index.

Your numbers

Symbol only: enter amounts in the currency you pick.
$
Enter your embedding provider's price

Your results

Total chunks
Total chunks
—
Chunks per document
—
Tokens to embed (millions)
—
One-off embedding cost
—
Retrieved context per question (tokens)
—

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

Chunks per document = ⌈(T − overlap) ÷ (size − overlap)⌉

Worked example

Using the default values shown in the calculator:

Number of documents500
Average tokens per document4000
Chunk size (tokens)512
Overlap (tokens)64
Embedding price per 1M tokens$0.1
Chunks retrieved per question8
  1. A 4,000-token document in 512-token chunks with 64 overlap: ⌈3,936 ÷ 448⌉ = 9 chunks.
  2. 500 documents → 4,500 chunks; retrieving 8 adds 4,096 tokens to each prompt.

Result:

Total chunks4,500
Chunks per document9
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

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.