LLM tokens and cost
RAG chunk size and overlap calculator.
Enter the document length, chunk size and overlap to count chunks, see what overlap adds to the embedding bill and size the context a query retrieves.
Chunks = ceil((length - overlap) / (chunk size - overlap)), and overlapped tokens are embedded twice. A 12,000-token document with 800-token chunks and 100-token overlap makes 17 chunks and embeds 13,600 tokens (13.3% more than the document). For 500 documents at an example $0.10 per 1M that is $0.6800.
Your numbers
Result
Worked example
A 12,000-token document, 800-token chunks, 100-token overlap, so a stride of 700. Chunks = ceil((12,000 - 100) / 700) = ceil(17.0) = 17. The last chunk starts at token 11,200 and holds 800 tokens. Tokens embedded = 12,000 + 16 x 100 = 13,600, which is 13.3% more than the document. For 500 documents that is 8,500 chunks and 6,800,000 tokens, costing 6,800,000 x 0.10 / 1,000,000 = $0.6800 at an example $0.10 per 1M. With no overlap the same set embeds 6,000,000 tokens for $0.6000 and makes 7,500 chunks. Retrieving 5 chunks adds up to 4,000 tokens to each prompt.
How it works
Chunks start every stride = chunk size - overlap tokens, so a document longer than one chunk needs ceil((length - overlap) / stride) of them. Each overlap is part of two neighbouring chunks, so it is embedded twice: embedded tokens = length + (chunks - 1) x overlap. OpenAI's embeddings guide says usage is priced per input token, which is why the embedded total is what you pay for; the price is an input because it differs by model.
Chunk size and overlap are tuning choices, not published standards. Smaller chunks versus larger chunks is a tuning trade-off (precision against lost context), a common rule of thumb rather than a published standard. This page counts tokens, so convert words or characters first with the token estimator. It splits purely by token count; splitters that respect sentences or headings will give slightly different counts. Re-embedding after content changes is a separate cost.
Sources and basis (opened 2026-10-08): Vector embeddings | OpenAI API. Everything else is arithmetic on your inputs.
All prices on this page are examples you can overwrite, not any provider's current prices. Check your provider's pricing page before you rely on a number. Results are planning estimates, not a quote or financial advice. Everything runs in your browser. Nothing you type is sent or stored.
FAQ
How many chunks will my document make?
Use ceil((length - overlap) / (chunk size - overlap)) when the document is longer than one chunk. A 12,000-token document with 800-token chunks and 100 tokens of overlap makes 17.
How much does chunk overlap add to embedding cost?
Each overlap is embedded twice, adding (chunks - 1) x overlap tokens per document. Here that is 13.3% more tokens than the document, $0.0800 more across 500 documents at the example price.
What chunk size and overlap should I use?
There is no single standard. Try a few settings and measure retrieval quality on your own questions. This calculator shows what each choice does to chunk count, embedding tokens and retrieved context.
Is embedding priced per token?
OpenAI's embeddings guide says usage is priced per input token. Enter your model's price per million tokens to get the cost.