Context Window Calculator
Check how system prompts, history, tool schemas, output, and safety margin fit within an LLM context window.
Runs entirely in your browser. Nothing you type is uploaded.
About this tool
Use Text mode to count pasted content or Token mode to enter known counts for the system prompt, conversation history, tool schemas, and expected output. Choose a safety margin to see total usage, remaining capacity, and a safe, warning, or exceeded status.
Questions & answers
- What should be included in the context calculation?
- Include the system prompt, conversation history, tool or function schemas, the current input, and the output tokens you want to reserve.
- What does the safety margin do?
- It reserves part of the model's context window for variation and uncounted overhead. A warning means the content fits the hard limit but has entered that reserve.
- When should I use Text mode or Token mode?
- Use Text mode when you have the actual content. Use Token mode when another tokenizer, API response, or log already gives you trusted token counts.