What Is Chunking in RAG? How AI Systems Split Documents for Retrieval

Document divided into smaller passage cards, with a magnifying glass selecting one for an AI answer, beside “What Is Chunking in RAG?”

Short Answer: What is chunking in RAG?

Chunking in RAG is the step that splits large documents into smaller passages, called chunks, before they are embedded and stored for retrieval. When someone asks a question, the system searches those chunks, pulls the most relevant ones, and hands them to the AI model to write an answer. How you split the documents affects what the system can find.

Key Takeaways

  • Chunks that are too small lose context, and chunks that are too large blur the match. Chunking is the balance between the two.
  • The main methods are fixed-size, overlapping, structure-based, and semantic chunking, and many systems combine them.
  • There is no universal chunk size. Real defaults differ: Microsoft suggests starting at 512 tokens with 25% overlap, while OpenAI’s file search defaults to 800 tokens with 400 overlap. (Microsoft, OpenAI)
  • Adding context to each chunk can help a lot. Anthropic reported that prepending a short description to each chunk cut failed retrievals by 49% in its tests. (Anthropic)
  • Good chunking improves the odds of finding the right passage. It does not guarantee an accurate answer.

A quick scope note: this article is about splitting documents for AI retrieval systems. It is not about “chunking” as a memory or study technique, which shares the name but is unrelated.

Retrieval-augmented generation, or RAG, lets a language model answer questions from your own documents instead of relying only on what it learned in training. Our RAG explainer covers the whole system. This guide zooms in on one step that quietly shapes everything after it: how documents are cut into pieces.

Where Does Chunking Fit in a RAG Pipeline?

  1. Ingest documents such as PDFs, web pages, manuals, or policy files.
  2. Chunk the text into smaller passages.
  3. Embed each chunk as a list of numbers that represents its meaning. See our explainer on embeddings.
  4. Index those vectors in a searchable store, such as a vector database.
  5. Retrieve the chunks most relevant to a question.
  6. Generate an answer by giving the retrieved chunks to the model as context.

Chunking happens early, but it shapes everything downstream. If a key fact is split across two chunks, or buried in a chunk about something else, later steps have a harder time recovering it.

Why Not Feed the Whole Document to the AI?

Sometimes you can. Anthropic notes that if a knowledge base is smaller than about 200,000 tokens, roughly 500 pages, you can simply include all of it in the prompt. Beyond that size, or when many documents are involved, chunking becomes practical for three reasons:

  • Context limits. Models can only process so much text at once. Our explainer on the context window covers this limit.
  • Embedding limits. Embedding models have their own maximum input length. Microsoft’s documentation gives the example of 8,191 tokens for one of OpenAI’s embedding models.
  • Focused matching. Semantic search compares the meaning of a question with the meaning of each chunk. A chunk that covers a whole 40-page document blends many topics, which makes a precise match harder.

That creates the core tradeoff. Smaller chunks tend to match more precisely but can lose surrounding context. Larger chunks keep more context but can dilute the match.

What Are the Main Chunking Methods?

There is no single correct method. Most approaches fall into four groups, and many systems mix them.

Fixed-size chunking

Text is cut into pieces of a set length, measured in tokens or characters, regardless of sentence or section breaks. It is simple, fast, and predictable to store. The downside is that it can cut through a sentence, a table row, or a numbered step, and it can separate a rule from the exception right after it.

Overlapping chunks

Consecutive chunks share some text, so an idea that crosses a boundary appears whole in at least one chunk. For example, if chunk one covers tokens 1 to 500, chunk two might start at token 451. Overlap helps with multi-step instructions and rules followed by exceptions. Too much overlap fills results with near-duplicates and inflates the index. In Chroma’s chunking research, reducing overlap improved a metric that penalizes redundant text.

Structure-based chunking

Documents are split along their own organization, such as headings, numbered sections, clauses, or pages. This tends to keep a topic together, which suits handbooks, contracts, and manuals. A widely used middle ground is recursive splitting. LangChain’s recursive text splitter, which its documentation recommends for generic text, tries to keep paragraphs together, then sentences, then words, only cutting smaller when a piece is still too long. By default it measures size in characters, not tokens.

Structure does not always win, though. In NVIDIA’s tests across several document collections, simple page-level chunking achieved the highest average accuracy and the most consistent results, and outperformed section-level chunking based on headings. Those tests used NVIDIA’s own extraction tools, so treat them as one data point.

Semantic chunking

Semantic chunking splits text where the meaning changes rather than at a set length. As Pinecone describes it, the document is broken into sentences, nearby sentences are grouped and embedded, and a new chunk starts where the meaning shifts noticeably. This can help with dense text that lacks clear headings, such as meeting notes. It costs more to run, because every group of sentences needs an embedding, and chunk sizes become less predictable.

Other variants build on these four. Parent-child, or small-to-big, retrieval searches small chunks but returns their larger parent section. LLM-based chunking asks a language model to find logical breaks.

Method Good for Watch out for
Fixed-size Simple defaults and mixed content Cutting through sentences, steps, and tables
Overlapping Ideas that cross boundaries Duplicate results and a larger index
Structure-based Well-formatted handbooks, contracts, manuals Messy or inconsistent formatting
Semantic Dense text without clear headings Higher ingestion cost and uneven chunk sizes

Worked Example: Chunking a Remote Work Policy

The following is a hypothetical, illustrative example. It does not describe a real company, policy, or test result.

Imagine a five-page Remote Work Policy with four sections: Eligibility, Approved Remote Days (with a table of allowances by department), Equipment and Reimbursement, and Exceptions and Approval. Someone asks: “How many remote days are allowed?”

  • Fixed-size, no overlap. The document is cut every 500 tokens. The remote-days table is split, so one chunk has department names with no numbers and the next has numbers with no labels. Retrieval may return half the table and produce an incomplete answer.
  • Overlapping. The same cuts with 100 tokens of overlap. Some rows now appear in both chunks, which reduces the chance of an orphaned row, but search may rank two near-identical chunks at the top.
  • Structure-based. The document is split by section heading. Approved Remote Days becomes one complete chunk, table included, and the question retrieves it in one piece.
  • Semantic. The system may detect that the table and its explanation belong together and keep them in one chunk. On this well-formatted document the result could look like structure-based chunking, but it would behave differently on a document with no headings.

The same question produces different results depending only on how the document was split, not on anything about the AI model.

How Do Headings and Metadata Help Retrieval?

A chunk on its own can be ambiguous. Take the sentence “Employees may work remotely up to two days per week, subject to manager approval.” Without knowing which policy, company, or version it came from, neither a retrieval system nor a reader can tell whether it applies.

Attaching metadata to each chunk helps. Useful fields include the document title, the section path, the page number, the effective date or version, and the source URL or file ID.

A related technique adds that context to the chunk text itself before embedding. Anthropic calls its version contextual retrieval: a model writes a short description, usually 50 to 100 tokens, that situates each chunk within its document, and that description is prepended before the chunk is embedded and indexed for keyword search. In Anthropic’s tests, this reduced failed retrievals by 49%, and by 67% when combined with reranking. Those are the company’s own results, and the method adds a model call for every chunk. Pairing it with keyword search is a form of hybrid search, and our guide to reranking explains the second step.

What Chunk Size Should You Use?

There is no universal number. Chunk size depends on the document type, the kinds of questions people ask, the embedding model’s limits, and the rest of the system. Published defaults and studies show how much the answer varies:

Source What it says
Microsoft Azure AI Search Start with 512 tokens (about 2,000 characters) and 25% overlap, or 128 tokens, then adjust for your content
OpenAI file search The default automatic strategy uses chunks of up to 800 tokens with 400 tokens of overlap
Pinecone Test smaller chunks, such as 128 or 256 tokens, against larger ones, such as 512 or 1,024 tokens
NVIDIA (2025 tests) Factoid questions did well with 256 to 512 tokens, while complex analytical questions did better with larger chunks or whole pages. Of the overlap values it tried, 15% worked best on one dataset
Chroma (2024 research) Recursive splitting at a chunk size of 200 with no overlap performed consistently well, and default settings in some popular tools performed relatively poorly

The practical approach is the one most of these sources recommend: try a few sizes, such as 256, 512, and 1,024 tokens, against a set of real questions, and keep the setting that retrieves the right passages most consistently. Measuring beats copying a number from a blog post, including this one.

Where Does Chunking Get Hard?

  • Tables. Splitting a table like a paragraph separates headers from rows, leaving numbers without labels or labels without numbers. Tables usually need to stay together, with headers and captions attached.
  • Headings. Body text often depends on its heading. “This applies only during the first 90 days” means little once it is separated from the heading that says what “this” is.
  • Multi-part answers. A five-step procedure, or a rule followed pages later by an exception, can end up in separate chunks. If only one is retrieved, the answer can be incomplete or misleading even though the full information exists.

For questions that depend on relationships across many documents, some teams add a knowledge graph on top of chunks. Our explainer on GraphRAG covers that approach.

Does Good Chunking Guarantee Accurate Answers?

No. Chunking improves the odds that the right text is retrieved. Accuracy also depends on:

  • How well the embedding model represents meaning.
  • Whether reranking puts the most relevant chunks first.
  • How the prompt tells the model to use the retrieved text.
  • Whether the source documents are current and correct.
  • Whether the model stays faithful to the retrieved text instead of adding unsupported claims. See our explainer on hallucination.

Chunking and grounding are related but separate. Good chunking gives the system a better chance of finding the right passage. Grounding is whether the final answer actually reflects what that passage says.

What Are the Practical Limits of Chunking?

  • Ingestion cost. Semantic and LLM-based chunking need embeddings or model calls for every document, which adds time and expense.
  • Embedding limits. Chunks longer than the embedding model’s maximum input are truncated or rejected.
  • Re-tuning. New document formats, a new embedding model, or a new content type often mean revisiting chunk settings.
  • Over-engineering. For a small set of short, simple documents, advanced chunking may add cost without a meaningful gain.

Why Does Chunking Matter for AEO?

AI search products rarely disclose how they split web pages, so the following is our inference, not a documented rule. Retrieval systems work with passages, not whole sites, which is part of what our guide to how AI search retrieval works describes. Pages built from self-contained sections, with clear headings, a direct answer near the top of each section, and tables that keep their labels, are easier to split cleanly and easier to quote accurately. That is the same logic behind writing answer capsules.

Learn More About AEO and AI Marketing at Prompt Insider

Since launching earlier this year, Prompt Insider has become a leading authority on AI marketing, Answer Engine Optimization (AEO), large language models, AI search, AI news, and the evolving future of digital discovery. As AEO becomes one of the hottest topics in marketing, Prompt Insider is helping define the conversation around how brands improve visibility, adapt their content strategies, and stay competitive in an increasingly AI-driven search environment.

Prompt Insider is the go-to resource for answer engine optimization, AI marketing, and AI search. Start with our core guides at thepromptinsider.com:

Get AEO insights in your inbox

Prompt Insider covers AEO, AI search, and AI marketing every week, breaking down what is changing and what brands need to do about it. Sign up for our emails at thepromptinsider.com to get it first.

Frequently Asked Questions

What is chunking in RAG?

Chunking is the step in a retrieval-augmented generation system that splits documents into smaller passages before they are embedded and stored, so the system can find and retrieve the most relevant pieces when someone asks a question.

Which chunking method splits text by meaning instead of length?

Semantic chunking. It groups and embeds nearby sentences and starts a new chunk where the meaning shifts noticeably, rather than cutting at a set number of tokens or characters.

What is the best chunk size for RAG?

There is no single answer. Published defaults range from about 512 tokens (Microsoft’s suggested starting point) to 800 tokens (OpenAI’s file search default), and studies have found smaller chunks suit factual lookups while larger ones suit analytical questions. Test a few sizes against real questions.

What is chunk overlap?

Overlap means neighboring chunks share some text, so an idea that crosses a boundary appears whole in at least one chunk. Microsoft suggests starting around 25% overlap. Too much overlap creates near-duplicate results.

Does chunking guarantee accurate AI answers?

No. It improves the odds that relevant text is retrieved, but accuracy also depends on the embedding model, reranking, prompt design, source quality, and whether the model stays faithful to what it retrieved.

Should tables be chunked like regular paragraphs?

Generally no. Splitting a table like prose separates headers from data. Tables usually work better kept together as one unit, with headers and captions attached.

Is chunking in RAG the same as the memory technique called chunking?

No. They share a name but are unrelated. This article covers splitting documents for AI retrieval, not grouping information to help people remember it.

Bottom Line

Chunking is a design decision, not a solved default. Fixed-size, overlapping, structure-based, and semantic methods each trade simplicity, cost, and retrieval quality differently, and published defaults disagree on size. Chunking can meaningfully improve how well a RAG system finds information, but it works alongside embeddings, reranking, and prompt design rather than replacing them. Test your choices against real questions instead of assuming one method or one number will work everywhere.

Sources: Microsoft Learn: Chunk large documents for vector search solutions in Azure AI Search, OpenAI API reference: Vector stores (chunking strategy), LangChain: Recursive text splitter, Pinecone: Chunking Strategies for LLM Applications, NVIDIA Technical Blog: Finding the Best Chunking Strategy for Accurate AI Responses (June 2025), Chroma Research: Evaluating Chunking Strategies for Retrieval (2024), Anthropic: Introducing Contextual Retrieval (September 2024). Results from NVIDIA, Chroma, and Anthropic come from their own tests on specific datasets. Product defaults can change. The worked example is hypothetical. We reviewed these sources on November 19, 2026.

About the author

Kai Williams

Kai Williams has been in marketing for years, with a long background in SEO before AEO had a name. He stepped into Answer Engine Optimization the moment AI started reshaping how people search, and has been tracking the shift ever since. At Prompt Insider, he covers AEO, AI marketing, and the future of search, breaking down what is changing and what brands need to do about it.

Get the insider edge

AI news, AEO tactics, and tool reviews — straight to your inbox.

Keep reading

Be a Prompt Insider. Get AI news, AEO insights, resources, and updates delivered straight to your inbox.