Context Window

Plan an AI context window by measuring prompt usage and reserving space for model output.

How this calculator works

Enter model context limit (tokens), prompt and history tokens, reserved output tokens. Select Calculate to apply the displayed formula and review the labeled results.

Formula / method

Remaining input capacity = context limit − prompt tokens − reserved output tokens

Worked example

A 128,000-token context with 48,000 prompt tokens and 8,000 reserved output tokens leaves 72,000 tokens.

Assumptions and limitations

The model’s published context limit includes the entered prompt, conversation history and reserved output.

Providers may count tool calls, images, reasoning or system instructions differently; use the provider tokenizer for exact counts.

Sources and methodology references