RAG Chunk Size & Overlap Calculator
Size a retrieval-augmented-generation pipeline before you write any code. Enter a document length, chunk size and overlap to get the exact chunk count, tokens duplicated by overlap, the embedding cost in USD, and how large the vector index will be. Runs entirely in your browser — no keys, no upload.
How it works
Fixed-size chunking slides a window of chunk_size tokens across your document, advancing by a strideeach step. The stride is the chunk size minus the overlap. Every calculation below is deterministic sliding-window arithmetic — the same logic LangChain's RecursiveCharacterTextSplitter and LlamaIndex's SentenceSplitter use to advance the window.
Let N be the document length in tokens, w the chunk size, o the overlap and s = w − o the stride.
- Token estimate.Tokens are used as entered. Characters are converted at about 4 characters per token, and words at about 1.33 tokens per word, following OpenAI's tokenizer guidance. These heuristics are close for English prose but not exact.
- Chunk count. If
N ≤ wthe whole document is a single chunk. Otherwise the count isceil((N − o) / s). This is algebraically identical toceil((N − w) / s) + 1; the tool computes both and they always agree, which is how you can trust the number. - Duplicated tokens. Every chunk after the first repeats exactly
otokens from its predecessor, so the overlap adds(chunks − 1) × otokens on top of the document. - Total tokens embedded =
N + (chunks − 1) × o. You pay to embed every one of them, including the duplicates. - Embedding cost =
total_tokens ÷ 1,000,000 × price_per_1M, with the price taken from the selected model (OpenAI text-embedding-3-small at $0.02/1M, -3-large at $0.13/1M, ada-002 at $0.10/1M, Cohere embed-english-v3.0 at $0.10/1M, Voyage voyage-3 at $0.06/1M) or your custom figure. This is a one-time cost per index build. - Vector store size =
chunks × dimensions × bytes_per_value, where a float32 value is 4 bytes, float16 is 2 and int8 is 1. Dimensions come from the model (1536, 3072 or 1024). This is the raw vector payload; database index structures and metadata sit on top of it. - Retrieval prompt budget =
top_k × wtokens. This is the upper bound of context your retriever injects into the prompt each query — keep it well under the generation model's context window.
Two guards protect you from silent mistakes: overlap must be smaller than the chunk size (otherwise the window never advances), and if a chunk is larger than the embedding model's maximum input the provider truncates it, so the tool warns you.
Worked examples
Frequently asked questions
Sources & references
- OpenAI — Embeddings guide (dimensions & max input tokens)
- OpenAI — API pricing (embedding price per 1M tokens)
- OpenAI — What are tokens (the ~4-characters-per-token heuristic)
- Cohere — Embed docs (embed-english-v3.0 dimensions & limits)
- Voyage AI — Embeddings docs (voyage-3 context length & dimensions)
- LangChain — RecursiveCharacterTextSplitter (chunk_size / chunk_overlap semantics)
- LlamaIndex — Node parsers (SentenceSplitter defaults)
Model prices, dimensions and input limits were last cross-checked against these sources on 2026-07-08. Providers change pricing without notice — use the Custom model option to enter current figures, and email me if a default looks stale.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want another embedding model added?
Email me at [email protected] — most fixes ship within 24 hours.