AI & LLM

RAG Chunking Calculator

Size your chunks against your embedding model, context window and retrieval depth.

Runs entirely in your browser · Nothing is sent or stored · No signup

Corpus
Chunking
tok
%
$

Per 1M tokens.

Model changes, chunking changes, corpus refreshes.

Retrieval budget
tok
tok
tok
Token counts use ~1.33 tokens per English word, which is close enough for sizing and wrong for billing — use your provider's tokeniser for that. Within roughly 256–768 tokens, chunk size has a small effect on retrieval quality; chunking strategy and reranking matter far more.

Chunks in the index

27,505

14.1M stored tokens · 1.18× duplication from overlap

Corpus

Raw tokens12.0M
Initial embedding cost$1.83
Annual re-index cost$7.32

Per request

Retrieved context2,560 tokens
Total prompt4,060 tokens
Context headroom123,940 tokens
Window utilisation3.2%
Maximum top-k that fits247

What this is for#

Two practical questions before you build: how many chunks will this corpus produce, and how many of them can I actually fit in the context window at retrieval time?

The context budget#

Retrieval depth × chunk size has to leave room for the system prompt, the question and the answer. It is common to discover that a chosen top-k does not fit, and to discover it in production when a long document arrives.

What to spend effort on instead#

Within roughly 256–768 tokens, chunk size has a small effect on retrieval quality — under 0.03 recall in our measurements. Chunking strategy and reranking are worth far more. Use this to check feasibility and cost, then spend your tuning time elsewhere.

Related reading

AI Systems

RAG Evaluation Lab

Most RAG systems are tuned by vibes. This is a reproducible harness that measures retrieval and generation separately, so you can see which half is failing.

IntermediateDifficulty: Intermediate~12h buildPython · Ragas · DuckDB
Code
Evaluation

Six RAG Chunking Strategies Compared

Fixed, recursive, semantic, structural, sentence-window and parent-document chunking measured on retrieval recall across three corpora.

IntermediateDifficulty: IntermediatePython · Ragas · pgvector
Notebook