Chunking

Splitting a long document's extracted text into smaller pieces sized for an embedding model. No chunking strategy recovers a reading order extraction already destroyed.

definition

Chunking is the process of splitting a document's text into smaller, bounded pieces sized to fit within an embedding model's input limit. It's a step used in retrieval-augmented generation and search indexing.

Also called: text chunking, document chunking

in-plain-terms

An embedding model and most LLM context windows have a token budget, so a whole document rarely fits, or embeds usefully, as one unit. Chunking divides the extracted text into pieces small enough to embed individually. It usually uses a target token count and some overlap between adjacent chunks, so a sentence straddling a boundary still appears in full somewhere.

Different chunking strategies trade off predictability against respecting structure. A fixed-size window cuts at a hard character count regardless of sentence or paragraph boundaries. Recursive chunking splits on paragraph, then line, then sentence, then word, only falling back to a smaller unit when the current one still overflows. Structure-aware chunking sections on detected headings first. All three inherit whatever the extraction stage handed them, since chunking runs after extraction. No strategy can recover a reading order or missing text that extraction already got wrong.

why-it-matters

  • Chunk quality is bounded by extraction quality. A scrambled reading order or a repeated header line gets faithfully chunked right along with the rest. Chunking has no way to tell damage from real content.
  • Too little overlap risks losing context at a chunk boundary. Too much means embedding and storing the same content repeatedly for no retrieval benefit past a certain point.

how-to-check

  • Paste extracted text and see chunk boundaries, overlap, and extraction-damage signals for three chunking strategies, entirely in your browser. Preview how your text will chunk

related-terms

faq

Should I chunk before or after extraction?
After, always. Chunking operates on whatever text extraction produced, and no chunking strategy recovers a reading order or missing content that extraction already got wrong.
Which chunking strategy should I use?
Recursive chunking with a moderate token target and 10-15% overlap is a reasonable default for most prose. Reach for structure-aware chunking when the source has reliable headings, and fixed-size only when predictable chunk counts matter more than clean boundaries.

related-reading

Into an LLM pipeline

See the term in real output.

Drop a file into the free reader and watch it happen.

Open the file reader →

Get an API key →