GPT Token Counter
Updated Free mock REST & WebSocket APIs
Get the exact number of tokens your text uses in OpenAI's GPT models, with an option to include chat-message overhead, and see how much of each model's context window it fills and what it costs to send.
Tokens, context window and input cost by model
| Model | Tokens | Context used | Input cost |
|---|---|---|---|
GPT-6 Astra OpenAI | ≈69 | <0.01% of 1.05M | $0.00069 |
GPT-6.1 Sol OpenAI | ≈69 | <0.01% of 1.05M | $0.00014 |
GPT-6 Sol OpenAI | ≈69 | <0.01% of 1.05M | $0.00014 |
GPT-6 Luna OpenAI | ≈69 | <0.01% of 1.05M | $6.9e-6 |
GPT-5.6 Sol OpenAI | ≈69 | <0.01% of 1.05M | $0.00028 |
GPT-5.6 Terra OpenAI | ≈69 | <0.01% of 1.05M | $0.00014 |
GPT-5.6 Luna OpenAI | ≈69 | <0.01% of 1.05M | $1.4e-5 |
GPT-5.5 OpenAI | ≈69 | <0.01% of 1.05M | $0.00034 |
GPT-5.4 OpenAI | ≈69 | <0.01% of 1.05M | $0.00017 |
GPT-5.4 mini OpenAI | ≈69 | 0.02% of 400K | $5.2e-5 |
GPT-5.4 nano OpenAI | ≈69 | 0.02% of 400K | $1.4e-5 |
GPT-5 OpenAI | ≈69 | 0.02% of 400K | $8.6e-5 |
GPT-5 mini OpenAI | ≈69 | 0.02% of 400K | $1.7e-5 |
GPT-5 nano OpenAI | ≈69 | 0.02% of 400K | $3.5e-6 |
GPT-4.1 OpenAI | ≈69 | <0.01% of 1.05M | $0.00014 |
GPT-4.1 mini OpenAI | ≈69 | <0.01% of 1.05M | $2.8e-5 |
GPT-4o OpenAI | ≈69 | 0.05% of 128K | $0.00017 |
GPT-4o mini OpenAI | ≈69 | 0.05% of 128K | $1.0e-5 |
o3 OpenAI | ≈69 | 0.03% of 200K | $0.00014 |
o4-mini OpenAI | ≈69 | 0.03% of 200K | $7.6e-5 |
gpt-oss-120b OpenAI · Groq | ≈69 | 0.05% of 128K | $1.0e-5 |
gpt-oss-20b OpenAI · Groq | ≈69 | 0.05% of 128K | $5.2e-6 |
Prices checked on 2026-10-18 from each provider's official pricing page (standard tier, USD per 1M tokens). Prices change often — verify before you budget.
OpenAI counts are exact (tiktoken o200k_base / cl100k_base). Claude, Gemini, Llama, Mistral, DeepSeek and Grok don't publish a browser tokenizer, so those are estimates calibrated against o200k — exact counts: Claude count_tokens API, Gemini countTokens.
🔒 Runs in your browser — your text is never uploaded or sent to any AI provider.
How to count GPT tokens
- Paste the prompt or message you plan to send.
- Keep “Count as one chat message” on to include the ChatML framing tokens OpenAI adds to each message.
- Compare the GPT models in the table: token count, % of context used and the input cost of this text.
How chat messages are counted
For chat-style requests, OpenAI wraps each message in special tokens. The OpenAI cookbook's counting recipe adds 3 tokens per message plus the role name (1 token) and 3 tokens to prime the assistant's reply:
tokens = Σ (len(encode(content)) + 3 + 1) + 3 # one user message of 50 tokens → 50 + 4 + 3 = 57
Tool/function definitions are serialized into the prompt too and can add hundreds of tokens. Reasoning models (o-series, GPT-5.x thinking) also bill hidden reasoning tokens as output.
GPT models: price and context
| Model | Input | Cached input | Output | Context |
|---|---|---|---|---|
GPT-6 Astragpt-6-astra | $10 | $1 | $50 | 1.05M |
GPT-6.1 Solgpt-6.1-sol | $2 | $0.10 | $10 | 1.05M |
GPT-6 Solgpt-6-sol | $2 | $0.20 | $10 | 1.05M |
GPT-6 Lunagpt-6-luna | $0.10 | $0.01 | $0.50 | 1.05M |
GPT-5.6 Solgpt-5.6-sol | $4 | $0.40 | $20 | 1.05M |
GPT-5.6 Terragpt-5.6-terra | $2 | $0.20 | $12 | 1.05M |
GPT-5.6 Lunagpt-5.6-luna | $0.20 | $0.02 | $1.20 | 1.05M |
GPT-5.5gpt-5.5 | $5 | $0.50 | $30 | 1.05M |
GPT-5.4gpt-5.4 | $2.50 | $0.25 | $15 | 1.05M |
GPT-5.4 minigpt-5.4-mini | $0.75 | $0.075 | $4.50 | 400K |
GPT-5.4 nanogpt-5.4-nano | $0.20 | $0.02 | $1.25 | 400K |
GPT-5gpt-5 | $1.25 | $0.125 | $10 | 400K |
GPT-5 minigpt-5-mini | $0.25 | $0.025 | $2 | 400K |
GPT-5 nanogpt-5-nano | $0.05 | $0.005 | $0.40 | 400K |
GPT-4.1gpt-4.1 | $2 | $0.50 | $8 | 1.05M |
GPT-4.1 minigpt-4.1-mini | $0.40 | $0.10 | $1.60 | 1.05M |
GPT-4ogpt-4o | $2.50 | $1.25 | $10 | 128K |
GPT-4o minigpt-4o-mini | $0.15 | $0.075 | $0.60 | 128K |
o3o3 | $2 | $0.50 | $8 | 200K |
o4-minio4-mini | $1.10 | $0.275 | $4.40 | 200K |
gpt-oss-120bgpt-oss-120b | $0.15 | — | $0.60 | 128K |
gpt-oss-20bgpt-oss-20b | $0.075 | — | $0.30 | 128K |
USD per 1M tokens, standard tier, checked 2026-10-18. Source: OpenAI pricing.
Fit more into the context window
- Minify JSON you paste into prompts — indentation and newlines are tokens.
- Prefer o200k models for non-English text; they need fewer tokens than cl100k.
- Keep the stable part of the prompt first so it hits the prompt cache (cached input is 50–95% cheaper).
Related tools
Frequently asked questions
Is my text sent to OpenAI, Anthropic or anyone else?
No. Everything runs in your browser: the tokenizer files are downloaded once and your text never leaves your device. Nothing is logged or stored.
How many tokens can GPT-5 handle?
GPT-5, GPT-5 mini and nano have a 400K-token context window (up to 272K input, 128K output). GPT-5.4, GPT-5.5, GPT-5.6 and GPT-6 models offer about 1.05M tokens, with long-context rates above 272K input tokens.
Is the count exact for GPT-4o and GPT-4.1?
Yes. Both use o200k_base, which this page runs with tiktoken's official ranks. GPT-4 and GPT-3.5 Turbo use cl100k_base, also shown.
Do images count as tokens?
Yes, but they are priced by resolution, not by text tokens, so they aren't included here. See OpenAI's vision pricing for the per-image formula.
Your business here? Sponsor this tool from $16/week. See placements