Chunking strategies for RAG

Before documents can be searched, they're cut into chunks. How you cut decides what retrieval can find: chunks that are too big bury the answer, and chunks that are too small lose the context.

Everyday analogy

Cutting a cake for guests: equal squares are quick (fixed-size), cutting along the layers keeps each piece sensible (semantic), and labelling which tier each piece came from helps you find the chocolate layer later (hierarchical).

Example

A 200-page HR handbook is split by chapter, then section, then paragraph, and each chunk remembers its chapter title. A question about "maternity leave" finds the right paragraph and knows it belongs to the "Leave" chapter.

📏Fixed sizeevery 500 tokens📑By headingone section each🧠By meaningsplit where topicchanges🔁With overlaprepeat a little atedges
Different ways to cut documents into searchable chunks.

Fixed-size

Cut every N tokens, with a 10–20% overlap so edges keep context. Simple and fast.

Recursive

Split by paragraph, then by sentence, until each piece fits the size limit.

Semantic

Cut wherever the meaning shifts, using embeddings to detect topic changes.

Hierarchical

Document → section → chunk. Each chunk keeps its "parents" for context.

Modality-specific

Text, images and tables each get their own chunker (e.g. tables kept whole, images captioned).

Agentic

An LLM reads the document and decides where to split based on the goal.

Try it yourself

About 15 min

Chunk a document

  1. Take a 2-page article. Split it three ways: by paragraph, by heading, and every 100 words.
  2. Ask the same question and give the AI only the one chunk you think answers it.
  3. Note which splitting kept the answer in one piece.

What you should see: Good chunks keep a complete idea together; bad ones cut answers in half.

Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.

Build it for real · guided projectBuild a document Q&A assistant (RAG, no code)About 60 min · No coding needed · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.