Chunk Overlap Calculator
Calculate effective chunk stride and overlap ratio for document splitting in RAG.
About Chunk Overlap Calculator
Chunk overlap ensures that information spanning chunk boundaries is captured in at least one chunk. The stride (chunk_size - overlap) determines how far the window advances. More overlap means more chunks but better retrieval recall at chunk boundaries.
Formula
Chunk Count
chunks = ceil((doc_length - overlap) / (chunk_size - overlap))
- overlap
- Number of tokens shared between consecutive chunks
Worked example
With the default values below, Chunk Overlap Calculator returns Number of Chunks of 11. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Chunk Size (tokens)minimum 1
- 512
- Overlap Size (tokens)minimum 0
- 50
- Document Length (tokens)minimum 1
- 5,000
Results
- Number of Chunks
- 11
- Stride
- 462 tokens
- Overlap Ratio
- 9.8%
Step by step
- 1Stride: chunk_size − overlap= 462
- 2Number of chunks= 11
- 3Overlap ratio= 9.8%
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 1 decimal place, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
What overlap ratio should I use?
10-20% overlap is a good default. Higher overlap (25-50%) improves recall for sentence-level retrieval but increases storage and embedding costs proportionally.
Does overlap affect embedding costs?
Yes — more chunks means more embedding API calls. With 20% overlap you'll have ~25% more chunks than with no overlap, increasing embedding costs accordingly.
