Chunk Overlap Calculator
Calculate effective chunk stride and overlap ratio for document splitting in RAG.
Inputs
Number of Chunks
11
Stride
462tokens
Overlap Ratio
9.8%
Step by step
Stride: chunk_size − overlap
512 − 50
= 462
Number of chunks
ceil((5000 − 50) / 462)
= 11
Overlap ratio
50 / 512 × 100
= 9.8%
How it works
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
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.