# What is chunking in RAG and AI search?

> Chunking splits a document into passages before indexing. OpenAI uses 800-token chunks by default; Google says pages need no chunking for its AI.

Canonical: https://promptlyfound.com/glossary/chunking
Updated: 2026-11-20

## Short answer

Chunking is **splitting a document into smaller passages before indexing, so that a retrieval system can return the relevant part of a page**. OpenAI's file search splits files into 800-token chunks with a 400-token overlap by default. Google says site owners do not need to break their content into small pieces for its generative AI features.

## Key findings

- OpenAI's vector stores split each file into chunks of 800 tokens with a 400-token overlap by default. Developers can set the chunk size between 100 and 4,096 tokens. [1]
- Anthropic says RAG systems usually split documents into chunks of no more than a few hundred tokens, and that a chunk can lose the context it needs to be understood. [2]
- In Anthropic's tests, adding 50 to 100 tokens of context to each chunk, with embeddings and BM25 together, cut the top-20 retrieval failure rate by 49%, from 5.7% to 2.9%. [2]
- Google says there is no requirement to break content into tiny pieces for AI, because its systems understand several topics on one page and show the relevant piece. [3]

Chunking decides which part of a page a retrieval system can hand to a language model, and Google says site owners do not need to do it themselves for its generative AI features. In developer tools it happens automatically, and OpenAI's file search splits files into 800-token chunks by default.

Chunking is the step in a retrieval system that splits each document into smaller passages, called chunks, before they are indexed. The system then searches the chunks and returns the passages that match a query, instead of whole documents.

## Why retrieval systems chunk

[Anthropic's post on Contextual Retrieval](https://www.anthropic.com/news/contextual-retrieval) describes the usual pipeline for retrieval-augmented generation. The system breaks the documents into chunks of usually no more than a few hundred tokens, turns each chunk into an embedding, and stores the embeddings in a vector database. At query time, it finds the chunks closest to the query and adds them to the prompt sent to the model.[2]

[OpenAI's retrieval guide](https://developers.openai.com/api/docs/guides/retrieval) shows the same step in a product. When a developer adds a file to a vector store, OpenAI chunks, embeds and indexes it automatically. A search returns the relevant chunks with their similarity scores and the file each came from.[1]

## Chunk size and overlap

By default, OpenAI splits each file into chunks of 800 tokens, with 400 tokens of overlap between consecutive chunks. Developers can change the size to anything from 100 to 4,096 tokens, and OpenAI says the overlap should not exceed half the chunk size.[1] A token is a unit of text of about a word or part of a word; [What are tokens in AI?](https://promptlyfound.com/llms/tokens) explains how they are counted.

Anthropic says the choice of chunk size, chunk boundary and chunk overlap can affect retrieval performance.[2]

## The context problem

A chunk can lose the context it needs. Anthropic gives the example of a chunk that reads "The company's revenue grew by 3% over the previous quarter". On its own, the chunk does not say which company or which quarter, so it is hard to retrieve for a question about either.[2]

Anthropic's fix is to prepend 50 to 100 tokens of explanatory context to each chunk before embedding it and before building the BM25 keyword index. In its tests, contextual embeddings and contextual BM25 together cut the top-20 retrieval failure rate by 49%, from 5.7% to 2.9%.[2]

## Chunking and web pages

For web pages, Google's advice is to leave the splitting to its systems. The OpenAI and Anthropic documentation describes chunking for documents that developers index themselves. It does not describe how ChatGPT search or Claude split web pages.

Google addresses web pages directly. [Google's guide to generative AI features in Search](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide), revised July 10, 2026, lists "chunking" content among the things site owners do not need to do. It says Google's systems understand the nuance of several topics on a page and show the relevant piece. It also says there is no ideal page length and that pages should be made for their audience.[3] [Google's guide to its ranking systems](https://developers.google.com/search/docs/appearance/ranking-systems-guide) also lists passage ranking, a system that identifies individual sections of a page to judge how relevant the page is.[4]

The risk in Anthropic's revenue example applies to any system that splits text. A passage that names its subject can be understood without the rest of the page, so it still makes sense when a system retrieves it alone. [How to write content that AI search can cite](https://promptlyfound.com/geo/content-for-ai-citations) covers writing self-contained sections, and [What is retrieval-augmented generation (RAG)?](https://promptlyfound.com/ai-search/rag) covers the rest of the retrieval pipeline.

## Sources

1. Retrieval. OpenAI API documentation. https://developers.openai.com/api/docs/guides/retrieval
2. Introducing Contextual Retrieval. Anthropic, 2024-09-19. https://www.anthropic.com/news/contextual-retrieval
3. Optimizing your website for generative AI features on Google Search. Google Search Central, 2026-07-10. https://developers.google.com/search/docs/fundamentals/ai-optimization-guide
4. A guide to Google Search ranking systems. Google Search Central, 2025-12-10. https://developers.google.com/search/docs/appearance/ranking-systems-guide

---

This is a plain-text copy of https://promptlyfound.com/glossary/chunking from Promptly Found. The web page is the canonical version and includes the charts.
