Markdown Text Chunker for RAG
Paste any Markdown document and this tool splits it into token-bounded, overlap-aware chunks ready for vector embeddings. Each chunk carries its full heading breadcrumb so your retrieval model always knows where in the document the text came from — the core idea behind aheading aware markdown chunker.
Everything runs locally: what you paste never leaves your browser.
Chunk your Markdown for RAG
- Chunk 1~43 tokens
Introduction to Vector Databases
Introduction to Vector Databases Vector databases store high-dimensional embeddings and enable semantic search at scale. They are a core component of modern RAG pipelines.
- Chunk 2~60 tokens
Introduction to Vector Databases > How Embeddings Work
Introduction to Vector Databases > How Embeddings Work An embedding model converts text into a dense numeric vector. Similar texts produce vectors that are close together in the embedding space, which is what makes semantic search possible.
- Chunk 3~64 tokens
Introduction to Vector Databases > How Embeddings Work > Chunking Strategy
Introduction to Vector Databases > How Embeddings Work > Chunking Strategy Before embedding, long documents must be split into smaller chunks. Each chunk should be semantically coherent and carry enough context for the retrieval model to rank it correctly.
- Chunk 4~62 tokens
Introduction to Vector Databases > Retrieval-Augmented Generation
Introduction to Vector Databases > Retrieval-Augmented Generation RAG combines a retrieval step with a generative model. The retriever fetches the most relevant chunks from the vector store, and the generator conditions its output on those chunks.
- Chunk 5~66 tokens
Introduction to Vector Databases > Retrieval-Augmented Generation > Why Chunk Size Matters
Introduction to Vector Databases > Retrieval-Augmented Generation > Why Chunk Size Matters Chunks that are too large dilute the embedding signal. Chunks that are too small lose context. A target of 256–512 tokens balances retrieval precision with context density.
Document chunking for RAG: why structure matters
Naive text splitters cut on character count alone, which means a chunk can start mid-sentence inside a subsection with no indication of where it came from. When that chunk is retrieved, the language model has no anchor — it cannot tell whether "chunking strategy" refers to database compression, video encoding, or vector search. This tool implementsdocument chunking for RAG the structural way: it parses every heading up to your chosen depth, builds a breadcrumb likeIntroduction > How Embeddings Work > Chunking Strategy, and prepends it to every chunk that falls under that heading.
The result is that each chunk is self-describing. An embedding model encodes both the local prose and its document position, so a retriever can distinguish two sections with similar wording but different roles. This is the key insight behind markdown chunking langchain-style pipelines, where MarkdownHeaderTextSplitter does the same job programmatically. This tool gives you the same output interactively, without writing any code.
How the chunker works
The pipeline has three stages. First, the Markdown is parsed into heading-bounded sections. Any heading at or above your chosen depth becomes a split point; deeper headings are treated as body text. Each section inherits the breadcrumb of all its ancestor headings.
Second, each section's body is split into sentences on punctuation boundaries. Sentence splitting is the right unit for a semantic markdown chunker online because it avoids cutting mid-thought: a sentence is the smallest unit that carries a complete idea, which is also the smallest unit an embedding model can represent faithfully.
Third, sentences are packed greedily into token-bounded chunks. The token budget uses the cl100k_base approximation of four characters per token — the same heuristic OpenAI documents for GPT-4. When a chunk is full, the next one starts, optionally re-appending the last few sentences of the previous chunk as overlap. Overlap gives embedding models continuity across boundaries, which reduces the retrieval gap that would otherwise appear at every chunk edge.
Using the output as a markdown text splitter for embeddings
The JSON export follows the OpenAI Embeddings batch format: an array of objects each with atext field and a metadata object. You can pipe that array directly into openai.embeddings.create or into any vector store that accepts pre-chunked documents. The CSV export is useful for inspection in a spreadsheet or for ingestion into pipelines that prefer tabular input. Both formats include the headers breadcrumb and the estimated tokenCount so downstream code can filter or re-chunk without re-parsing the Markdown.
If you are building a markdown text splitter for embeddings in Python, the JSON output can be loaded with json.load and passed to any embeddings client. The breadcrumb in metadata.headers is ready to store as a filterable attribute in Pinecone, Weaviate, Qdrant, or Chroma.