# Chunking (RAG)

> Cutting a long file into small bits. Then search can find the right bit.

**Field:** Artificial Intelligence  
**Category:** Retrieval & Search  
**Also known as:** Document Chunking, Text Splitting

## Think of it like

Think of it like cutting a cake into slices. Each person takes just the slice they want.

## Definition

Chunking is cutting long documents into small pieces, called chunks, before they are stored for search. A search then finds the few chunks that answer a question, not whole files. A chunk is often a few hundred tokens long. Chunks usually share a little text with the next one, so an idea on the edge is not cut in half. Cutting at headings and paragraphs works better than cutting at a fixed size.

## Example

Emma's 80-page manual becomes 400 chunks of about 300 tokens each. A question about returns now finds the two chunks on returns, not the whole manual.

## Why it matters

Chunk size and borders decide what the search can find. Bad chunking breaks RAG before the model even runs.

## Common mistake

Cutting at a fixed size through the middle of tables and lists. The halves make no sense on their own.

## Three principles

- **Small pieces.** Often a few hundred tokens.
- **A little overlap.** Ideas are not cut in half.
- **Follow the structure.** Headings and paragraphs.

## Related terms

- [Retrieval-Augmented Generation (RAG)](https://learn.benibix.com/term/ai/retrieval-augmented-generation)
- [Token (AI)](https://learn.benibix.com/term/ai/token)
- [Embedding (AI)](https://learn.benibix.com/term/ai/embedding)
- [Document Parsing](https://learn.benibix.com/term/ai/document-parsing)
- [Contextual Retrieval](https://learn.benibix.com/term/ai/contextual-retrieval)

![A long document cut into four chunks. Each chunk shares a small strip with the next, so a sentence on a boundary is not lost.](https://learn.benibix.com/diagrams/rt-chunking.svg)

---

Source: https://learn.benibix.com/term/ai/chunking
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
