Token and context budget calculator
This page answers two questions: how many tokens is this text, and does the whole request still fit the window once the system prompt, the tool schemas, the history, and the reserved answer are counted. Everything runs in your browser.
These are estimates, and the page says so on purpose. Exact counting needs the vendor's own tokenizer. OpenAI's is open and could be shipped to the browser, but the counts here use a character heuristic so the page stays small and offline. Treat the numbers as planning figures with a few percent of error, not as an invoice.
Characters 0
Words 0
OpenAI-style estimate 0
Claude 4.7 and later estimate 0
Whole request, on the Claude estimate 0
Headroom under the window 0
Why the two estimates differ
Anthropic says Claude 4.7 and later uses a newer tokenizer that produces roughly 30 percent more tokens for the same text. A prompt that costs $2 per million input tokens on paper can therefore cost noticeably more in practice, and a budget that was sized on an older model's counts can quietly stop fitting. The second row above applies that 30 percent; it is a rule of thumb from Anthropic's own note, not a measurement of your text.
This page does not model Google, because we have not found an equivalent published ratio for it, and inventing one would be worse than leaving it out. If you need exact counts, count them with the vendor's tokenizer; the Python counter shows how to do it on a real trace, and the OpenAI tokenizer page gives exact counts in the browser for OpenAI models only.
The margin exists because a request that fits arithmetically can still degrade. The 10 percent margin is a convention, and long inputs tend to be recalled less reliably than short ones regardless of what fits. Costing the result is the next step: the cost guide, and the long-context surcharge calculator for what happens when the input crosses a vendor's threshold.