OpenAI Token Counter
Count pasted text, reserve room for the answer and estimate its cost.
GPT-6 estimate using o200k_base. OpenAI has not published a GPT-6 mapping in tiktoken.
Counts pasted text locally, up to 1 million characters. A complete API request also includes message formatting, instructions and tools. Output reserve includes reasoning tokens.
Count tokens before sending a request
Paste a prompt, document or code sample, choose a model and reserve output tokens. The tool counts text in your browser, shows remaining context space and estimates Standard text-token costs. Your text is never sent to an API or analytics service.
The output reserve is a planning amount, not a charge. The cost shown with that reserve assumes the model uses all of it. Actual billing uses the tokens consumed, including reasoning output. Use the input-only figure when estimating the cost of reading your text before an answer is generated.
GPT-6 counts are estimates
As checked on September 24, 2026, OpenAI’s public tiktoken model map does not list Astra, Sol or Luna. For those models, this tool reports an o200k_base estimate. It does not claim to reproduce their complete API token accounting.
For models mapped by OpenAI’s published tokenizer, the tool counts raw text with the corresponding BPE encoding: o200k_base for the mapped GPT-4o, GPT-4.1, GPT-5 and o-series names, or cl100k_base for the older GPT-4 family. The encoding is shown beside the result so the method is visible before you use the number.
How much context is left?
The context window includes input and output. A 1,050,000-token window with a 128,000-token output reserve leaves 922,000 tokens for input. Reserving a smaller answer leaves more input room, subject to the selected model’s limits.
A real request may also contain system or developer instructions, previous messages, tool definitions and results. Count those as part of your input budget. Pasting only the newest user message will understate the complete request. Images and other media use different accounting and are outside this text counter.
Turn the count into a useful budget
For GPT-6, crossing 272,000 input tokens changes the pricing tier for the whole request. A prompt near that boundary deserves another check using the completed request’s input usage. The result here uses the selected model’s verified limits and rates, including the long-context tier when applicable.
Use the API pricing calculator to add cached reads, cache writes, service modes and monthly volume. Use prompt caching savings when the same instructions or document prefix appears across many requests. The model comparison shows the cost of the same workload across Astra, Sol and Luna.
Why word counts are different
Tokens are text pieces, not words. A word can split into several pieces, and punctuation, spaces, code and non-English text change the count. This tool uses a local tokenizer rather than a fixed characters-per-token shortcut. It accepts up to one million characters per run and loads the selected encoding when you first count text.