Analyzer · chunking for RAG
Compare RAG chunking strategies on your own text
Paste a document, add questions with the passage that answers each, and see how seven chunking strategies cut the text and what a BM25 retriever returns. Runs in your browser; your text is never uploaded.
Try it
Everything runs in this tab. The tool does not upload what you enter and stores nothing unless you export it.
1. Document
No document yetDocument text
select a passage to use as an answerBuild the document to see it here.
2. Questions and answer passages
0 of 12Each question needs the passage in the document that answers it. Select that passage in the document text, then press Use selection as answer for this question. You can also paste the exact passage. Questions without a passage are left out of every figure.
Questions from headings use Markdown headings (# Title) and numbered headings (1. Title or 2.3 Title). Each heading becomes “What does the document say about …?” with the first sentence under it as the answer passage.
3. Strategies and retrieval
sizes in estimated tokens- BM25 or TF-IDF matches words. It stands in for embeddings, so the results show structural effects of chunking: where cuts fall, how large chunks are, and whether heading context helps. They do not say which embedding model to buy.
- Small samples are noisy. Use at least 10 questions with gold passages. The tool warns below 3.
- Token counts are estimates. The results are one retriever’s behaviour on your questions, not a verdict on your system.
4. Results
Document map
one row per strategyEach row is the whole document, left to right. Vertical lines are chunk boundaries. The shaded bands are the chunks the retriever returned for the selected question; tab to a band to hear its rank and position. The top lane shows answer passages: the dark bar is the selected question, light bars are the others. Hover a row to read its chunk.
Text version of the map
Question drill-down
top k chunks per strategyExport
The JSON and Markdown files contain your document and questions, so keep them private. The settings link holds strategy sizes, overlap, retriever and k only. It never contains your text.
How to use Chunking Strategy Comparator
- Paste a document or load the sample. Up to 300 KB. Press Use this document to build the text view.
- Add questions and their answer passages. Select text in the document and press Use selection as answer for this question, or paste the exact passage.
- Pick strategies and press Compare. Set sizes and overlap, choose BM25 or TF-IDF, then press Compare strategies.
- Read the table and the map, then drill into one question. Check where each answer was cut and which chunks the retriever returned.
What the tool measures
A retriever can only return what a chunk contains. If a chunk boundary falls inside the sentence that answers a question, the answer arrives split across two results or not at all. This tool tests that effect on your own text. It cuts the same document with each strategy, ranks the chunks for each question with the same retriever, and reports what came back.
The starting points people copy disagree. Microsoft’s Azure guidance begins with 512 tokens with an initial overlap of 25% in one place and with a page length of 2,000 characters and 500 characters of overlap in another. It describes each as a start, not an optimum. Pinecone says fixed-size chunking is “the best path in most cases”, a recommendation that its article does not back with measurements. Chroma found that its recursive splitter at 200 tokens with no overlap “performs well”. The report adds that “while it does not achieve the best result, it is consistently high performing”. Its runs covered five corpora and two embedding models. None of these results transfers to your document automatically, which is why the comparison is worth running.
Run it before you build the index. Change the document, the questions or the strategies and the table, map and drill-down update together. For the reasoning behind the choice of sizes, read the guide on testing chunk size before you build RAG. For the strategies themselves, read the guide that compares RAG chunking strategies.
The seven strategies and where they come from
Every size in this tool is an estimated token count, so all strategies are compared in one unit. LangChain’s own default counts characters, not tokens, and its recursive splitter documentation says so directly.
| Strategy | What it cuts on | Where the idea comes from |
|---|---|---|
| Fixed 256, Fixed 512 (overlap 50) | A token count, cut between words. Overlap repeats the tail of the previous window: 50 tokens is about 10% of a 512-token window. | Pinecone describes fixed-size chunks as one where “we simply decide the number of tokens in our chunk”. Azure’s fixed-size examples use 10 to 15% overlap. |
| Sentences 256 | Whole sentences, packed up to the size. Overlap repeats trailing sentences. | LlamaIndex’s SentenceSplitter “attempts to split text while respecting the boundaries of sentences”. |
| Paragraphs 384 | Whole paragraphs. A paragraph larger than the size falls back to sentences. | The LangChain docs define no separate paragraph splitter. Paragraphs are the first unit its recursive splitter tries to keep whole. |
| Recursive 256 | The largest separator that keeps pieces under the size: paragraph, line, space, then character. | LangChain-style: the shared kit’s recursive splitter, given LangChain’s documented default separators “\n\n”, “\n”, “ ” and an empty string, in that order. It is not LangChain’s code. |
| Headings 384 | Heading sections, each kept with its heading line. A section over the size is split on paragraphs, then sentences. | Azure: “Embedded markup, like HTML or Markdown, have heading syntax that can be used to chunk data by sections.” |
| Semantic 384 | Breakpoints where two-sentence windows are least similar: the weakest 25% of gaps become cuts. Similarity is TF-IDF here, not embeddings. | LlamaIndex’s semantic splitter “adaptively picks the breakpoint in-between sentences using embedding similarity”. This tool measures similarity with TF-IDF, so it is a lexical stand-in. |
| Custom | Any of the six above, with its own size and overlap. | Use it to test a size the defaults do not cover. |
The heading-section and semantic rows are the least settled. Chroma reports that the Kamradt semantic default scored “slightly below average across all metrics” in its runs, and LlamaIndex warns that its regex “primarily works for English sentences” and may need threshold tuning. Treat the semantic row as one data point on your text, not as the answer.
How the scoring works
The questions are yours. For each question with a gold passage, the tool asks whether the top-k chunks contain the answer, and how the answer sits relative to the chunk boundaries. Questions with no gold passage are left out of every figure, and the tool says how many were left out.
The scope of each measure is stated plainly. Found, intact and tokens returned use only the top k chunks. Split is judged over every chunk of the strategy. Mid-sentence cuts describe every chunk of the strategy. MRR uses the full ranking, so it is not capped at k.
| Measure | Rule |
|---|---|
| Found in top k | At least one top-k chunk covers at least half of the gold passage’s characters. |
| Intact in top k | At least one top-k chunk contains the whole gold passage. |
| Split answers | No single chunk contains the gold passage, but the chunks together cover all of it. This counts over the whole strategy, not only the top k, because a cut is a property of the chunking. |
| Rank | The position, in the ranking of chunks that share at least one term with the question, of the first chunk that overlaps the gold passage at all. A chunk that shares no term with the question is never ranked. |
| MRR | The mean over questions of 1 divided by that rank. The overlap test is any overlap, not the 50% test used for found. A question with no overlapping chunk in the ranking scores 0, and the zero stays in the mean. |
| Tokens returned | The mean, over questions, of the estimated tokens in the top-k chunks. That is the text you would send to a model. |
| Mid-sentence cuts | The share of chunks that start or end inside a sentence, over every chunk of the strategy, using the same sentence splitter throughout. |
Reciprocal rank and mean reciprocal rank follow the definitions in the ir-measures documentation: the reciprocal of the rank of the highest-scoring relevant document, averaged over queries. That page gives no formula for a query with no relevant result, so this tool sets that case to 0 and keeps it in the average. Some tasks define recall@k as whether any relevant result appears in the top k. This tool reports that as “found”, with the 50% rule above, because a chunk can hold only part of an answer.
The best mark in the table goes to the highest found, intact and MRR values in each column. Tokens returned has no best mark, because a smaller number can also mean less context. Chroma’s recall is token-level and is not comparable with these counts, so do not place its numbers beside this table.
The heading path option works separately. The tool detects Markdown headings and numbered headings and records the heading path above each chunk’s first character, using the same detector for every strategy. Turned on, that path is indexed with the chunk and counted in the tokens it returns. This is a rule-based version of the idea in Anthropic’s contextual retrieval, which has a model write 50 to 100 tokens of context per chunk. This tool does not call a model.
Limits and what it cannot tell you
The retriever is lexical. BM25 uses k1 of 1.2 and b of 0.75, the defaults in Lucene and Elasticsearch, as Lucene 9.9.0 documents them. The retriever also lowercases words, stems them, drops English stop words and ignores terms shorter than two characters, so matches happen on word stems. TF-IDF uses the same text handling. BEIR calls BM25 “a robust baseline”, and the same paper reports that re-ranking and late-interaction models “on average achieve the best zero-shot performances, however, at high computational costs”. If your system uses embeddings, the chunk sizes that win here may not win there. NVIDIA’s results also depend on its own embedding and reranker stack, and the team says that chunking is just one of many hyperparameters in a RAG system.
The tool does not generate an answer, so it cannot tell you whether a model would answer correctly from the chunks it receives. It measures what the retriever sends, not what the model says about it.
The numbers come from your questions and your single document. Ten questions is a practical floor, not a stability threshold. Below that, one question moves results a lot; at ten questions, one question moves a percentage by ten points. A strategy that wins on one handbook can lose on another, so repeat the test on a second document before you commit.
Token counts are an estimate. The shared kit describes its estimate as typically within about 15% for English prose. That is the kit’s own description; it has not been checked here against a vendor tokenizer, and it drifts more for code, tables and non-English text. Vendor tokenizers are the authority when a budget depends on the count.
Heading detection is deliberately simple: Markdown lines starting with #, and numbered lines such as “2.3 Title” that do not end in punctuation. A numbered list item such as “1. Open the till” is read the same way when it starts with a capital letter and has no final punctuation, so it can create a heading path and a question. A document with bold text as headings, or with setext underlines, gets no heading paths and no heading questions from this tool, although the Headings strategy uses the shared kit’s broader detector to split sections.
Privacy: what happens to your input
Everything runs in this tab. The document, the questions, the gold passages and the results are never sent to a server. The tool’s own code makes no network requests and saves nothing in the browser. The page’s shared site scripts load as they do on every page. Reloading the page clears the text.
Downloads are the only way data leaves the tab, and they create files on your device. The CSV contains summary numbers only. The JSON file contains your document and questions. The Markdown report contains the questions, the summary and the per-question results, but not the document text. Treat both as private. The share link carries settings only: strategy sizes, overlap, the retriever, k and the heading-path switch. It never contains your text. The document is limited to 300 KB so that the analysis stays responsive.
Questions
Is my data uploaded?
No. The document, questions and results stay in this tab. The tool's code sends nothing to a server and saves nothing unless you download a file. The site-wide promo banner is separate and never receives your text. The share link holds settings only, never your text.
How accurate is this?
It is a repeatable test of one lexical retriever, not a measurement of your production system. BM25 matches words, so it stands in for embeddings only in a structural sense. Read the table as the effect of chunking on your questions, not as a score to quote.
Is there one best chunk size?
No. NVIDIA found that the best token size changed by dataset. Earnings peaked at 512 tokens and FinanceBench at 1,024 in its tests. Run this comparison on your own questions before you settle on a number.
Does more overlap always help?
No. Chroma found that reducing overlap raised its IoU scores, which penalise repeated text. Overlap helped recall in one of its TokenText settings. Overlap also repeats text that uses up the context window, so test it on your data.
What do found, intact and split mean?
Found means a top-k chunk covers at least half of the answer passage. Intact means one top-k chunk contains the whole passage. Split means no single chunk contains the passage, but the chunks together cover it, so a boundary cuts through the answer.
How is MRR calculated here?
For each question with a gold passage, take 1 divided by the rank of the first chunk that overlaps the passage at all, counting down the ranking of chunks that share at least one word with the question. The overlap test is any overlap, not the 50 percent test used for found. If no overlapping chunk is ranked, the score is 0, and that zero stays in the average. The sources do not define this case, so the tool states its own convention.
Why are the token counts estimates?
The tool uses a heuristic from the shared text kit, which describes it as typically within about 15% for English prose and has not checked it against a vendor tokenizer. Vendor tokenizers are the authority. Use the counts to compare strategies with each other, not to budget an API bill.
Can I test with fewer than 10 questions?
You can, but the output is noisy. The tool warns below three questions with a gold passage and advises at least ten, because one question moves a percentage by 10 points at that size. Add questions until the differences hold up.
Read more about this
Two plain-language guides that go deeper than this page can, with sources.