Course contentsShow
← AI Engineering
Lesson 336 of 1,8869. Retrieval-Augmented Generation (RAG) - BasicsFree lesson

Fixed-Size Chunking

Splitting documents into equal-length chunks by character or token count with configurable overlap.

Fixed-Size Chunking

What you'll learn: How to split documents into equal-length pieces to make them compatible with RAG systems and embedding models.


When you feed long documents into a RAG pipeline, you can't just throw entire PDFs or articles at your embedding model—they have token limits. Fixed-size chunking is the simplest strategy: you divide text into uniform segments of N characters or tokens, optionally with overlap between consecutive chunks.

How It Works

Imagine slicing a loaf of bread. Each slice is the same thickness (your chunk size), and you can choose whether slices share a bit of crust (overlap). In code terms:

  • Chunk size: 500 characters or 128 tokens
  • Overlap: 50 characters (so the last 50 chars of chunk 1 appear in chunk 2)

Why overlap? It prevents important context from being split awkwardly. If a key sentence sits at a boundary, overlap ensures both neighboring chunks capture it.

When to Use It

Fixed-size chunking shines when:

  • You need simplicity and speed (no parsing logic required)
  • Your documents are uniform in structure (essays, articles)
  • You're prototyping and want a baseline

The Trade-offs

This method is blind to document structure. It might cut mid-sentence or split a critical paragraph. It treats a heading the same as body text. But it's predictable, easy to implement, and works surprisingly well for many RAG applications.

You'll configure chunk size based on your embedding model's limits and your LLM's context window. Start with 256-512 tokens and adjust based on retrieval quality.

Key Takeaway: Fixed-size chunking divides documents into equal-length segments with optional overlap—simple, fast, and a practical starting point for most RAG systems.