AI token and context budget calculator

Count text in your browser with o200k_base or cl100k_base, then compare it with a context limit, output reserve, and safety buffer you enter.

AI token and context budget calculator input

Input size (UTF-16 code units): 0 / 100,000

Input stays in this browser tab. The limit is 100,000 UTF-16 code units. Tokens from API request structure, images, files, and tool definitions are not included.

Add a buffer for request-format or model-specific differences.

Your input is not stored or sent. Shared results contain only a summary. Token counts are a plain-text estimate for the selected encoding, not total API usage.

Result

Results appear here after execution.

Share result

Share the tool link and result text together. No URL is included in the result. Check the below content and then share it.

Usage examples and processing criteria

Count the sample with o200k_base. With a 32,000-token context limit, 2,048 tokens reserved for output, and a 512-token safety buffer, the remaining input budget is 32,000 minus those three amounts. An API request may use more tokens for message formatting, images, files, tool definitions, and other overhead.

Frequently asked questions

Which tokenizer does this use?

It counts the plain text you enter using OpenAI’s o200k_base or cl100k_base encoding. Choosing an encoding does not provide an exact count for a particular model’s full API request.

Does this show exact API usage or the model’s remaining context?

No. You enter the context limit and output reserve yourself. The count excludes system and developer message formatting, tool definitions, images, files, service-added tokens, and model-specific limits, so it does not replace usage information returned by an API.

Is my input sent to a server or stored?

No. The tokenizer runs in a separate browser worker using files bundled with the page. Input is not stored or added to URLs, analytics events, or server requests. Shared results contain only a token-count summary.

Calculation criteria and reference materials

Verification of calculation criteria: · Calculation·verification principles · Report errors