★ Recursive chunking, visualized
Recursive Chunking for RAG
Recursive splitting tries separators in order: blank lines, then line breaks, then sentence ends, then spaces, then single characters. It uses the first separator that appears, packs the pieces into chunks up to the size limit, and recurses into any piece that is still too big with the next separator.
- Runs in your browser
- No signup
1,181 characters · loading tokenizer… · nothing leaves your browser
Recursive · 300 chars · overlap 40
6 chunks
- 52
- avg tokens
- 29 / 71
- min / max
- 15
- overlap tokens
- $6.20
- embed 1M docs
Loading the tokenizer; token counts are estimates until it's ready.
one chunkoverlapClick a chunk to inspect it.
Chunk inspector
Click any coloured chunk in the document to see its text, size, heading path and what it shares with its neighbours.
Chunk sizes
Tokens per chunk (estimated). A tight cluster means predictable chunks.
Embedding cost assumes text-embedding-3-small at $0.02 per 1M tokens (OpenAI, checked 8 Nov 2026), counting overlap twice.
Export config
Copy-ready code for the strategy and settings above. Comments flag where a library differs.
from langchain_text_splitters import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
chunk_size=300,
chunk_overlap=40,
separators=["\n\n", "\n", ". ", " ", ""],
keep_separator="start",
)
chunks = splitter.split_text(text)Your retrieval is only as good as your chunks.
I build RAG systems with evals, so you know when the answers get better or worse.
How it works
Recursive splitting tries separators in order: blank lines, then line breaks, then sentence ends, then spaces, then single characters. It uses the first separator that appears, packs the pieces into chunks up to the size limit, and recurses into any piece that is still too big with the next separator.
This tool follows LangChain's RecursiveCharacterTextSplitter: separators are kept at the start of the following piece, overlap is built by dropping pieces from the front of the previous chunk, and whitespace is trimmed from each chunk.
Source: LangChain's RecursiveCharacterTextSplitter.
When to use it
Good fit
- The default for most text documents: help centres, docs, articles, policies.
- When you want chunks that end at paragraph or sentence boundaries where possible.
- When you need a size limit but don't want to cut through every sentence.
Watch out for
- Chunks lose the heading they sit under, so 'Eligibility' text can float free of its topic.
- Separators are kept at the start of the next chunk, so with '. ' a chunk can begin with a full stop.
- Long unbroken text (minified code, tables) falls through to character splitting.
Where to start
Start with a size that fits one or two paragraphs and a small overlap. If answers need the section title, add it to each chunk or move to markdown-aware splitting.
Then test it: write down twenty real questions, check which chunks come back for each, and compare strategies on the same set. The main visualizer lets you put two strategies side by side.
Questions engineers actually ask
Why does a chunk start with a full stop?
Which separators should I use?
Does it match LangChain exactly?
What chunk size should I use for RAG?
Does my text leave the browser?
Other strategies
More from the workbench
Fine print
Tools: on the house.
Engineer: by the hour.
The visualizer was free. Production RAG with evals is what I build.
I'm Himanshu, an AI and full-stack engineer. I build MVPs, AI agents and the growth plumbing around them for early-stage startups.
