Skip to content
ZeroServer.tools

Text Chunker for RAG

Split large text into overlapping chunks by character count, word count, or sentence boundary — output as JSON for embeddings and RAG pipelines.

Source text

0 characters · 0 words

Total Characters: 0Total Words: 0Chunks: 0

How RAG text chunking works

Retrieval-augmented generation (RAG) pipelines embed documents in pieces, not all at once — a whole PDF rarely fits in an embedding model's context window, and even when it does, a single vector for an entire document is too coarse to retrieve precisely. This tool splits your text into smaller, overlapping chunks and outputs a ready-to-use JSON array, so each chunk can be embedded and stored individually in a vector database (Pinecone, Weaviate, pgvector, Chroma, and similar stores all expect this kind of pre-split input).

Three splitting strategies are supported. By character count slides a fixed-width window across the raw text — simplest and most predictable, but it can cut a sentence in half. By word count does the same on whitespace-separated words, which keeps chunk sizes closer to token counts for most tokenizers. By sentence boundary packs whole sentences into each chunk up to a target character size, so chunks never split mid-sentence — usually the best choice for prose, articles, and documentation. Boundaries include the full-width used by Chinese and Japanese and the Devanagari danda , so a CJK document chunks properly instead of coming out as one chunk; and because every chunk is sliced from the original text rather than rebuilt from the pieces, a chunk is always an exact substring of what you pasted, line breaks included.

The overlapsetting repeats a small amount of trailing content at the start of the next chunk. This matters because a fact or reference that spans a chunk boundary would otherwise be lost or truncated in both chunks; overlap ensures it appears in full in at least one of them. A common starting point is a chunk size of 300–800 characters (or 100–300 words) with an overlap of 10–20% of the chunk size — tune both values based on your embedding model's context window and how granular you need retrieved passages to be. Everything runs locally in your browser — no text is uploaded anywhere.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Splitting a long document into overlapping chunks for an embedding pipeline.
  • Choosing a chunk size and overlap before committing to an indexing run.
  • Splitting on sentence boundaries so chunks do not cut mid-thought.
  • Producing a JSON array of chunks for a retrieval index.
  • Comparing character, word and sentence chunking on the same text.

Frequently Asked Questions

What chunk size works best for retrieval?
Commonly 200-500 tokens for prose. Too small and a chunk loses the context that makes it meaningful; too large and the embedding averages several topics, which blurs the match.
Why do chunks overlap?
So a passage spanning a boundary is not lost. Without overlap, a sentence split across two chunks appears whole in neither, and the retrieval that needed it fails silently.
Should chunks respect sentence boundaries?
Yes where possible — a chunk cut mid-sentence embeds a fragment, and the fragment's meaning can differ from the sentence's. Splitting on paragraphs first and sentences second is the usual approach.
Do chunks need metadata?
Almost always. A retrieved chunk with no source, section or date cannot be cited or filtered, and citation is usually the point — the answer has to be traceable back to the document.
Is a fixed size right for every document?
No. Code, tables and transcripts each have their own natural units, and forcing a prose-sized window across them splits functions and rows in half. Structure-aware chunking beats a fixed count where the structure exists.

Common errors and gotchas

  • Chunking with no overlap, so an answer spanning a boundary is never retrievable.
  • Choosing a chunk size larger than the embedding model's context, which silently truncates.
  • Splitting mid-sentence on a character count, which produces chunks that read as fragments.
  • Losing the source reference per chunk, which makes a retrieved passage uncitable.
  • Chunking structured content such as a table, where the rows lose their header.

Related Text Tools tools

Private & free — this tool runs entirely in your browser.