devtools.codes

RAG Chunking Playground

RUNS LOCALLY

See the chunks your settings actually produce before you index anything. Each chunk shows its exact offsets in the source, its character count and an estimated token count, so you can judge whether a boundary lands mid-sentence and whether your overlap is doing useful work or just duplicating content.

Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information.

How to use it

  1. Paste a representative sample of the material you plan to index, not a short test string.
  2. Pick a strategy. Recursive suits most prose; fixed is predictable but ignores meaning entirely.
  3. Set the chunk size and overlap, and watch the boundaries move as you adjust them.
  4. Read the distribution in the header: the smallest, largest and mean chunk, and how much is duplicated.

A worked example

The example loads three paragraphs about chunking itself, at a 400-character size with 50 characters of overlap using the recursive strategy.

It shows how the recursive strategy prefers paragraph boundaries and only falls back to finer separators when a paragraph will not fit. Raising the overlap past half the chunk size triggers an advisory, because at that point most of each chunk is a copy of its neighbour.

Press Example in the workspace above to load it.

Questions

What is the best chunk size for RAG?

There is no single answer, which is why this tool shows you the result rather than recommending a number. Most prose corpora work somewhere between 300 and 800 characters. Smaller chunks retrieve precisely but lose the context that makes a passage meaningful; larger ones carry context but return padding alongside the answer. Try your own material at two or three settings.

How much overlap should I use?

Usually ten to twenty per cent of chunk size. Overlap exists to stop a relevant passage being cut in half at a boundary, because a sentence that starts in one chunk and finishes in the next is retrievable from neither. Past about half the chunk size it stops helping: you inflate the index, raise embedding cost, and crowd out genuinely different material with near-duplicates.

What does the recursive strategy actually do?

It tries separators from coarsest to finest. First it splits on blank lines, grouping whole paragraphs until adding another would exceed the size. If a single paragraph is still too large it splits on line breaks, then sentences, then words, then raw characters as a last resort. The effect is that boundaries land at natural breaks wherever the size allows.

Are the token counts exact?

No, they are estimates based on character count and labelled as such. Real tokenisation depends on the model and its vocabulary, so counts vary between providers for identical text. Use these figures to compare settings against each other, not to budget an embedding run.

Does my input leave the browser?

No. Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information. Nothing you paste is logged, stored or sent to an analytics event, and there is no account to attach it to.