RAG Text Chunker
Split Markdown or text into retrieval-ready chunks by headings, words or characters — with overlap and metadata, in your browser
Input
Sections split at heading boundaries; any section larger than the max is further split by characters.
Examples
Split by Markdown headings
# API Reference
Base URL: …
## Authentication
Use a bearer token.
## Errors
Returns JSON.
→ 3 chunks:
[0] API Reference
[1] API Reference > Authentication
[2] API Reference > ErrorsEach heading starts a new chunk; the source path keeps the hierarchy so retrieval knows where a chunk lived.
Fixed size with overlap
Strategy: fixed-words · max 200 · overlap 30
→ adjacent chunks share their last/first 30 words, smoothing context transitions.Overlap prevents a concept that straddles a boundary from being split across two unrelated chunks.
Export for embeddings
[
{ "index": 0, "heading": "Intro", "content": "…", "tokens": 128 },
{ "index": 1, "heading": "Setup", "content": "…", "tokens": 95 }
]Download the chunks as JSON — index, heading, content and token estimate — ready for a vector database.
Examples
Recursive chunking with overlap
Strategy: recursive
Target size: 500 chars
Overlap: 50 chars[ { "chunk_id": "chk_001", "index": 0, "content": "...",
"char_count": 498, "estimated_token_count": 124,
"source_header": "# Installation" }, ... ]Recursive splitting keeps paragraph and sentence boundaries intact, with 50 chars of overlap carried into the next chunk.
About this tool
Text Chunker splits Markdown or plain text into LLM- and retrieval-friendly pieces. Choose a strategy — by headings, by word count, by character count, or recursive (paragraph → sentence → character) — set an overlap so context bleeds between chunks, and export the result as structured JSON ready for a vector store or RAG pipeline.
Each chunk carries metadata: an id, its index, the character count, an estimated token count, and the source heading it came from. The recursive strategy respects natural boundaries so you don't slice a sentence in half, and a hard cap keeps very large inputs manageable. Everything runs locally; nothing is uploaded.
How to use this tool
Paste your text
Drop in Markdown or plain text — documentation, a transcript, an article, or any long passage you need to split.
Pick a strategy and size
Choose headings, words, characters, or recursive, then set the target size and an optional overlap between chunks.
Review the chunks
Chunks render with index, char/token counts and source headers, and overlap is highlighted so you can see the seam.
Export as JSON
Download a versioned JSON array of chunks (id, index, content, counts, header) for your indexing pipeline.
Use cases
Build a RAG index
Split documentation into overlapping chunks and export the JSON for embedding and retrieval.
Fit long context into a model
Break a document that exceeds a context window into model-sized pieces you can feed sequentially.
Prepare eval datasets
Produce consistent, metadata-tagged chunks as inputs for retrieval or summarization experiments.
Common mistakes
Mistake:Setting overlap larger than the chunk size.
Fix:Overlap should be a fraction of the chunk size — too much duplicates content across chunks and wastes tokens.
Mistake:Choosing character splitting for prose.
Fix:Use the recursive strategy for natural text so chunks break on paragraph and sentence boundaries instead of mid-word.
Mistake:Treating the token estimate as exact.
Fix:The per-chunk token count is an approximation; use your model's tokenizer for billing-critical counts.
Frequently asked questions
Which chunking strategy should I use?
For natural prose and Markdown, use the recursive strategy — it splits on paragraphs, then sentences, then characters, so chunks don't break mid-word. Use heading-based splitting when your sections are already meaningful boundaries, and word or character counts when you need fixed sizes.
What is overlap for?
Overlap repeats a small number of characters (or words) from the end of one chunk at the start of the next. It preserves context across chunk boundaries, which improves retrieval quality in RAG pipelines by avoiding an important sentence being split in half.
Is the token count per chunk exact?
No — it is an approximation. The per-chunk estimated token count is useful for sizing, but for billing-critical counts you should run the text through your specific model's tokenizer.
Is my text uploaded anywhere?
No. All splitting and the JSON export happen locally in your browser. Nothing you paste is sent to a server.
Related guides
References & standards
Related tools
Agent Tool Flowchart Builder
Design agentic tool-call DAGs with decision branches and bounded loops. Validates reachability, cycle handling, and emits clean Mermaid flowcharts — fully in your browser.
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language