RAG Chunking Strategies: How to Split Documents for Better Retrieval
On this page
Short answer: Chunking splits long documents into smaller pieces before embedding them for RAG. Good chunks are small enough to be specific but large enough to keep context. A reliable starting point is recursive, structure-aware chunking of roughly 300–800 tokens with 10–20% overlap, plus metadata such as title, section and page. Then test: measure whether the right chunks are retrieved for real questions, and adjust size, overlap or strategy (semantic or parent-child chunking) based on results.
Key takeaways
- Chunking quality often matters as much as the LLM you choose.
- Respect document structure (headings, paragraphs, tables).
- Add metadata to every chunk for filtering and citations.
- There is no universal best size: evaluate on your own questions.
Why chunking matters
- Embedding models have input limits
- Large chunks dilute meaning, so retrieval becomes less precise
- Tiny chunks lose context, so answers become incomplete
- Retrieved chunks consume the LLM’s context window and cost
Main chunking strategies
| Strategy | How it works | Good for |
|---|---|---|
| Fixed-size | Split every N tokens/characters with overlap | Quick baselines, uniform text |
| Recursive | Split by paragraphs, then sentences, then words until chunks fit | Most general documents (recommended default) |
| Structure-aware | Split by headings, sections, HTML/Markdown elements, pages | Manuals, policies, documentation |
| Semantic | Split where meaning shifts, using embedding similarity between sentences | Long, loosely structured text |
| Parent-child | Retrieve small chunks, but pass the larger parent section to the LLM | Precise retrieval with full context |
| Sliding window | Overlapping windows across text | Transcripts and continuous text |
Example: recursive chunking in Python
from langchain_text_splitters import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
chunk_size=1000, # characters
chunk_overlap=150,
separators=['\n\n', '\n', '. ', ' ']
)
chunks = splitter.split_text(document_text)
print(len(chunks), chunks[0][:200])
As a rough guide for English, 1,000 characters is about 200–250 tokens. Many splitters can also measure length in tokens directly.
Choosing chunk size and overlap
- Short factual Q&A (FAQs, policies): smaller chunks, around 200–400 tokens
- Explanatory content (manuals, reports): medium chunks, around 400–800 tokens
- Overlap: 10–20% so sentences cut at boundaries still appear intact in one chunk
- Check top-k: retrieved chunks × chunk size must fit comfortably in the LLM context
Add metadata to every chunk
{
'text': '...chunk text...',
'source': 'student-handbook.pdf',
'section': 'Batch timings',
'page': 4,
'updated': '2026-10-01'
}
Metadata enables filtering (e.g. only the latest policy), citations in answers, and easier debugging. Many teams also prepend the document and section title to the chunk text before embedding.
Special cases
- Tables: keep a table together, or convert rows to text with column headers repeated
- PDFs: clean headers, footers and page numbers; use a layout-aware parser for multi-column pages
- Code: split by functions or classes, not arbitrary lines
- FAQs: one question + answer per chunk
How to evaluate your chunking
- Write 30–50 real questions with the expected source passages
- Measure retrieval: is the right chunk in the top-k results (hit rate, recall@k)?
- Measure answers: correctness and faithfulness to retrieved text
- Change one setting at a time (size, overlap, strategy) and compare
Build your first pipeline with a PDF chatbot using RAG.
Common mistakes
- One giant chunk per page or document
- Splitting mid-sentence with no overlap
- Losing headings, so chunks don’t say what they’re about
- Never testing retrieval separately from answer quality
Frequently asked questions
What is the best chunk size for RAG?
There’s no single best size. Start around 300–800 tokens with modest overlap and tune using your own evaluation questions.
Is semantic chunking always better?
Not always. It costs more to compute and doesn’t consistently beat good structure-aware chunking; test it on your data.
How does chunking relate to embeddings?
Each chunk becomes one embedding. See What are embeddings? and vector databases for RAG.
Is chunking asked in interviews?
Yes, it’s a favourite topic. See RAG interview questions.
Conclusion
Effective RAG chunking strategies respect document structure, use sensible size and overlap, carry metadata, and are tuned by measuring retrieval. Get chunking right and every later step of your RAG system improves.
Build production-style RAG systems in our Generative AI App Developer course.
Learn with Mehul Prajapati in Borivali West
At Mehul Prajapati’s institute, you get 100% practical, hands-on training by industry experts with a minimum of 5+ years of experience, plus job-oriented programmes with placement support. Weekday and weekend batches are available, with multiple 2-hour slots between 8 am and 6 pm.
Address: 12th Floor, 1214, Gold Crest Business Centre, LT Rd, Above Westside Showroom, Borivali West, Mumbai, Maharashtra 400092
Call: +91 99301 12627 / +91 96645 45072
Visit the centre or call us to choose the right course and batch and to know the current fee structure.