Skip to content

Menu

RAG Chunk Size Calculator

Calculate optimal RAG chunk sizes

Runs entirely in your browserAIFree, no sign-up
Loading tool

01What is RAG Chunk Size Calculator?

Chunking choices look harmless until the embedding bill arrives or the retrieved context crowds out the answer. This calculator lets you test those choices before you index anything. You give it eight inputs: document count, average document length in tokens, chunk size, chunk overlap, embedding model, retrieval top-K, context window and system prompt size. It then reports chunks per document, total chunks, tokens to embed, embedding cost, raw vector storage and how much of the context window a query would use. Chunking is modelled as a sliding window, the same idea behind the fixed-size splitters in LangChain and LlamaIndex. Each chunk is chunk-size tokens long and starts chunk size minus overlap tokens after the previous one. The last chunk takes whatever is left. A document no longer than one chunk is exactly one chunk. Tokens to embed are the document length plus the overlap repeated in every chunk after the first, because that repeated text is billed again. Cost uses OpenAI's list prices for text-embedding-3-small, text-embedding-3-large and text-embedding-ada-002, as checked on 8 November 2026. Storage is chunks times the model's dimensions times four bytes, which is the raw float32 size. Here's the default case worked through. One hundred documents of 2,000 tokens, 512-token chunks and 64 tokens of overlap give five chunks per document and 500 in total. The overlap turns 200,000 document tokens into 225,600 embedded tokens, about $0.0045 with text-embedding-3-small. The vectors take 3,072,000 bytes. Five retrieved chunks plus a 500-token system prompt use 3,060 tokens, roughly 2.4% of a 128,000-token window. Recommendations appear when overlap is over 30% of the chunk, when retrieval fills more than 80% of the window or doesn't fit, when chunks are under 128 or over 2,048 tokens, and when overlap isn't smaller than the chunk. Be honest with yourself about the limits. Real splitters break on sentences, headings or code blocks, so actual counts drift from this estimate. Retrieved size assumes every chunk is full, which slightly overstates usage when final chunks are short. Storage leaves out metadata, the stored text and index structures such as HNSW graphs. Prices change, so check your provider before you budget.

AI engineers planning a RAG index use it to check chunk counts, embedding cost and context fit before they run the first embedding job. The tool runs entirely in your browser, so your data never leaves your device.

02How to use RAG Chunk Size Calculator

  1. Enter Total Documents and Avg Doc Length (tokens), or load the Technical docs, Chat history or Code files example.
  2. Set Chunk Size (tokens) and Chunk Overlap (tokens).
  3. Pick an Embedding Model and set Retrieval Top-K, Context Window (tokens) and System Prompt (tokens).
  4. Read Total Chunks, Embedding Cost, Vector Storage and Context Usage, plus any Recommendations.
  5. Check the Context Window Visualization, or click reset to return to the defaults.

03Worked examples

Input: Defaults: 100 docs × 2,000 tokens, chunk 512, overlap 64, text-embedding-3-small, Top-K 5, 128,000 window, 500 system tokens
Result: 5 chunks/doc, 500 total chunks; 225,600 tokens embedded, $0.004512; raw storage 3,072,000 bytes; context used 3,060 tokens (2.39%), 124,940 left
Each chunk after the first repeats 64 tokens, so 200,000 document tokens become 225,600 embedded tokens.
Input: 1,000 docs × 2,000 tokens, chunk 512, overlap 0
Result: 4 chunks/doc, 4,000 chunks; 2,000,000 tokens embedded, $0.04; 24,576,000 bytes of vectors
With no overlap the embedded token count equals the document token count exactly.
Input: 10,000 docs × 5,000 tokens, chunk 1,000, overlap 200, text-embedding-3-large
Result: 6 chunks/doc, 60,000 chunks; 60,000,000 tokens embedded, $7.80; 737,280,000 bytes; Top-K 5 retrieves 5,000 tokens (4.30% of the window with the system prompt)
Storage is chunks × 3,072 dimensions × 4 bytes, so the large model doubles storage per chunk versus 1,536-dimension models.
Input: Defaults but Avg Doc Length 300 tokens
Result: 1 chunk/doc, 100 chunks; 30,000 tokens, $0.0006; retrieved tokens 1,500
A document shorter than the chunk is one chunk, and each retrieved chunk only holds 300 tokens, not 512.
Input: Defaults but Retrieval Top-K 20, Context Window 8,000, System Prompt 1,500
Result: Retrieved 10,240 tokens, 11,740 used (146.75% of the window), -3,740 left; recommendations warn the window is over 80% full and that the context doesn't fit
Twenty 512-token chunks alone overflow an 8K window.
Input: Chunk Size 512, Chunk Overlap 512
Result: 0 chunks, $0 embedding cost, plus the recommendation: Overlap must be smaller than the chunk size, and the chunk size must be above zero.
When overlap equals the chunk size the window never advances, so nothing is counted.

04Common use cases

  • Estimating the one-off embedding bill before indexing a company wiki into Pinecone, Weaviate or pgvector
  • Choosing between 512 and 1024-token chunks for a documentation chatbot built with LangChain or LlamaIndex
  • Checking whether top_k=20 still fits when you move a prototype from a 128K model to an 8K model
  • Sizing raw vector storage for a codebase search tool before picking a database tier
  • Showing a manager how much extra embedding cost a 30% overlap adds compared with 10%
  • Comparing text-embedding-3-small and text-embedding-3-large on cost and storage for the same corpus

05Tips

  • Overlap of 10 to 20 percent of the chunk size is a common starting point. More overlap mostly adds cost and near-duplicate results.
  • If you use a non-OpenAI embedding model, pick the OpenAI model with the same dimensions for the storage figure and scale the cost by hand.
  • Budget storage at a few times the raw float32 figure once you add metadata, stored text and an HNSW or IVF index.
  • Measure Avg Doc Length with the tokenizer of your embedding model, not word counts. Code and non-English text produce more tokens per word.
  • When the context bar goes red, lowering Top-K is usually cheaper than shrinking chunks, since smaller chunks mean re-embedding everything.

06Related concepts

Retrieval-augmented generation, Text chunking, Embeddings, Vector databases, Top-k retrieval, Context window.

Frequently Asked Questions

What is RAG Chunk Size Calculator?

RAG Chunk Size Calculator is a free, browser-based developer tool on AIDToolStack. Calculate optimal RAG chunk sizes It requires no installation or sign-up and works entirely in your browser.

Is RAG Chunk Size Calculator free to use?

Yes. No sign-up, no fees and no usage cap.

Does RAG Chunk Size Calculator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe