Glossary

Recursive chunking

Splitting text on a ranked list of separators, from paragraph breaks down to single characters, until every chunk fits a size limit.

Recursive chunking, often called recursive character text splitting after LangChain’s RecursiveCharacterTextSplitter, is the most common form of chunking in a RAG pipeline. It splits a document on the first separator in a ranked list, usually the blank line between paragraphs, and any piece still longer than the size limit is split again on the next separator, then the next, until everything fits. The result keeps paragraphs and sentences together where it can and only breaks inside them when it has to.

How recursive character text splitting works

The input is plain text, usually produced by a document loader. LangChain’s default separators are a double newline, a single newline, a space and finally the empty string, which splits between individual characters as a last resort. The splitter breaks the text on the first separator, then merges neighbouring pieces back together until adding another would exceed the chunk size. Pieces that are too large on their own go down a level to the next separator. Chunk overlap repeats a set amount of text from the end of one chunk at the start of the next, so a sentence near a boundary appears in both.

Size is measured in characters by default. Most frameworks can measure in tokens instead, using the same tokenization as the model, which is the safer choice when chunks must fit an embedding model limit. LlamaIndex’s sentence splitter follows a similar idea and prefers to keep whole sentences and paragraphs together.

Separators for different formats

The separator list can follow the structure of the content. LangChain ships language-specific lists for code, so Python is split on class and function definitions before blank lines, and Markdown is split on headings first. For PDFs, the quality of the result depends on the text that PDF parsing produces: if headings and paragraph breaks are lost during extraction, the splitter has little to work with.

Content

Typical separators, in order

Prose

Blank line, newline, space, character

Markdown

Headings from level one down, then blank lines

Python code

Class and function definitions, then blank lines

HTML

Block-level tags such as section, div and p

Choosing chunk size and overlap

Common starting points are 256 to 512 tokens per chunk with 10 to 20 percent overlap. Smaller chunks give sharper embeddings but less context per hit, while larger chunks carry more context and more noise. No single setting suits every corpus, so teams compare a few sizes on a test set using recall@k before committing. Parent document retrieval and sentence window retrieval loosen the trade-off by matching on small pieces and returning larger ones.

Recursive vs semantic chunking

Recursive splitting is fast, deterministic and free to run, which is why it is the default text splitter in most RAG frameworks. Semantic chunking uses embeddings to find topic changes, costs an embedding call per sentence group and suits loosely formatted text such as transcripts. Published evaluations from 2024, including work from Chroma and from Vectara researchers, found that recursive or fixed-size splitting at a sensible size performed about as well as semantic methods on typical document sets. Semantic vs recursive chunking compares the two side by side, and fixed size vs semantic chunking covers plain fixed-length splits.

Limits of recursive chunking

Recursive splitting only sees characters. It cannot tell that a table continues across a page break or that a pronoun refers to something three chunks back, and each chunk is still embedded without the rest of the document. Table extraction, contextual retrieval and late chunking handle those cases. Chunking is a workaround, not a design and tables in PDFs look at where fixed boundaries break down.

Recursive chunking and Exabase

Deep Search indexes Resources as they are stored, with no chunking logic to build or maintain, and returns matching passages with page numbers for documents and timestamp ranges for audio and video. Exabase does not document how it splits text internally or expose chunk size or overlap settings. If your pipeline already uses a recursive splitter, Extract can supply the raw text: it returns a document as ordered chunks with page numbers, and the extraction results guide shows how to fetch them.

LangChain vs LlamaIndex compares the two frameworks that popularised these splitters, Exabase vs LangChain compares managed indexing with building your own pipeline, and the document extraction use case covers getting clean text out of files in the first place. File extraction explains the one-endpoint approach to parsing.

FAQs

What is recursive character text splitting?

It is a chunking method that splits text on a ranked list of separators, such as paragraph breaks, line breaks and spaces. Any piece that is still too long is split again on the next separator until all chunks fit a size limit.

What are the default separators in RecursiveCharacterTextSplitter?

A double newline, a single newline, a space and the empty string, tried in that order. The empty string splits between characters when nothing else works.

What chunk size should I use for recursive chunking?

Start with 256 to 512 tokens and 10 to 20 percent overlap, then test a few sizes on your own questions. Measure in tokens when chunks must fit an embedding model’s limit.

Is recursive chunking better than semantic chunking?

For most structured documents it performs about as well and costs far less to run. Semantic chunking can help on long, loosely formatted text such as transcripts.

Does recursive chunking work for code?

Yes, with language-specific separators. LangChain’s language presets split code on class and function definitions before blank lines, so functions tend to stay whole.

Does Exabase use recursive chunking?

Exabase does not document the splitting method behind Deep Search. Content is indexed when it is stored and search returns the matching passage with its page number or timestamp, so there is no chunk size to tune.

Related pages: Chunking, Semantic chunking, Chunk overlap, Text splitter, Document loader, Semantic vs recursive chunking, Parent document retrieval, Late chunking, Extract, RAG accuracy.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.