Work out retrieval chunk size instantly with clear inputs, formula shown and shareable results.
Sliding-window chunking advances by chunk size minus overlap, so the chunk count is roughly document length divided by that stride. Overlap protects facts that straddle a boundary but duplicates tokens, inflating both embedding cost and index size. The duplicated-token figure is the price you pay for that safety margin.
Sliding-window chunking
stride = chunk - overlap; chunks = ceil((document tokens - overlap) / stride); duplicated = chunks x chunk - document tokens
256 to 512 tokens suits precise question answering; 1000 or more suits summarisation and narrative context. Test both against your own evaluation set rather than guessing.
Splitting on structure first — headings, paragraphs, code blocks — then packing to a token budget usually retrieves better than blind fixed windows, because chunks stay semantically whole.