RAG Context Budget

Plan whether retrieved documents fit inside an AI model context window.

How this calculator works

Enter retrieved documents, tokens per chunk, prompt overhead tokens, context limit tokens. Select Calculate to apply the displayed formula and review the labeled results.

Formula / method

Budget = context limit − prompt overhead; retrieved tokens = documents × tokens per chunk

Worked example

12 chunks of 700 tokens plus 1,800 prompt tokens use 10,200 of a 16,000-token context.

Assumptions and limitations

Every retrieved chunk has the entered average token length.

Tokenization, reranking, citations, tools and response reservation can change the real budget.