How to use the RAG Chunk Size Calculator
- 1. Describe your documentsEnter how many documents you have and their average length in tokens, words or pages.
- 2. Set chunkingChoose chunk size, overlap, top-k, your model's context window and tokens reserved for the prompt and answer.
- 3. Check and previewSee totals, and paste sample text to preview the actual chunks.
How chunks are counted
Retrieval-augmented generation (RAG) splits documents into chunks, embeds each chunk as a vector and retrieves the most relevant ones for each question. With chunk size C and overlap O, each new chunk starts C − O tokens after the last. A document of T tokens therefore needs ceil((T − O) ÷ (C − O)) chunks, or 1 if it fits in a single chunk. The calculator checks this formula against a direct simulation in our tests.
Retrieval then adds top-k × C tokens to every prompt, on top of your system prompt, question and answer.
Worked example
The defaults are 200 documents of 10,000 tokens, 500-token chunks, 50-token overlap, top-5 and a 128,000-token context window with 3,000 tokens reserved. Each document gives 23 chunks (step 450 tokens), so you store 4,600 vectors. You embed 22,20,000 tokens, which is 11% more than the raw text because of the overlap. Each question retrieves 2,500 tokens, so the full prompt is 5,500 tokens, 4.3% of the context window.
Choosing a chunk size
- Smaller chunks (200–400 tokens) match precise facts better; larger ones (800–1,200) keep more context together.
- 10–15% overlap helps when answers span chunk boundaries; more mostly adds cost.
- Split on headings and paragraphs where you can; the preview here uses word boundaries and about 4 characters per token.
- Test on 20–30 real questions and compare answers; that beats any rule of thumb.
Frequently asked questions
Is my pasted text uploaded?
No. The preview runs entirely in your browser, and the text isn't sent anywhere.
How accurate are the word and page conversions?
They're estimates (about 1.33 tokens per English word and 500 words per page). Other languages and code can use more tokens per word.
Is the RAG chunk size calculator free?
Yes. You can open the RAG chunk size calculator and fill in everything without signing up. When you calculate chunks for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.