Count OpenAI tokens exactly.
Paste text or attach files and images to inspect GPT token usage locally.
Text, code, PDF, DOCX, images, audio, or video · 12 MB per file
Your input, measured across providers.
Choose a provider card to inspect every available model.
Workload & Scaling Planner +
A measurement, not a guess disguised as fact.
OpenAI text is encoded locally with the model family’s BPE encoding. API message wrappers, tools, and hidden provider instructions can add tokens.
Every result identifies its method and accuracy level. Pricing is refreshed from Models.dev with the bundled registry available as an offline fallback.
Read the complete methodology →How this OpenAI token calculator works
OpenAI text is counted locally with the BPE encoding assigned to the selected model. This measures the raw content exactly; API message wrappers, tool definitions, and provider-side instructions can add tokens.
Different GPT model families can use different encodings. The selected model determines the tokenizer, context limit, and price used by the calculator.
For supported vision models, the browser reads image dimensions and applies OpenAI’s published detail and tile rules. The image is never uploaded.
Read the official OpenAI documentation ↗Models included in this counter
Registry reviewed 2026-10-02
| Model | Tokenization method | Context window | Input / 1M | Output / 1M |
|---|---|---|---|---|
| GPT-6.1 Sol | Exact local BPE | 1,050,000 | $2.00 | $10.00 |
| GPT-6 Luna | Exact local BPE | 1,050,000 | $0.10 | $0.50 |
| GPT-6 Sol | Exact local BPE | 1,050,000 | $2.00 | $10.00 |
| GPT-6 Astra | Exact local BPE | 1,050,000 | $10.00 | $50.00 |
| GPT-5.6 Luna | Exact local BPE | 1,050,000 | $0.20 | $1.20 |
| GPT-5.6 Sol | Exact local BPE | 1,050,000 | $4.00 | $20.00 |
| GPT-5.6 Terra | Exact local BPE | 1,050,000 | $2.00 | $12.00 |
Rates shown are USD per 1,000,000 tokens, verified against the public pricing catalogue on 2026-10-02. The table refreshes from the same live source the calculator uses. Provider invoices and official documentation remain authoritative.
Measure against the model you use
Compare cost with the same real workload
Compare approaches, not just models
Frequently asked questions
Which tokenizer does this OpenAI token calculator use?+
It uses the local BPE encoding configured for the selected OpenAI model. Current GPT models in this catalog use o200k_base.
Will the result match OpenAI API usage exactly?+
The pasted content count is exact for its encoding, but a complete API request can add system messages, role wrappers, tool definitions, images, and provider-side tokens.
How are OpenAI image tokens calculated?+
The browser reads image dimensions and applies the published detail and tile rules for the selected vision model without uploading the image.
Do system messages and tools add OpenAI tokens?+
Yes. System instructions, role wrappers, tool schemas, and structured outputs may contribute tokens beyond the raw text pasted into this calculator.
What is a token in an AI model?+
A token is a small unit of content processed by a language model. It may be a whole word, part of a word, punctuation, whitespace, or—in multimodal models—a unit assigned to an image. Different providers can split the same input differently.
How is LLM API input cost calculated?+
Input cost is calculated as input tokens divided by one million, multiplied by the selected model’s input price per million tokens. Provider tiers, cached input, tools, and message wrappers can affect final billing.
Does this tool upload my prompt, document, or image?+
No. Text, PDF and DOCX extraction, image-dimension reading, and token calculations run in your browser. Zero prompts, document contents, or uploaded images are sent to TokenCalculator.dev or another calculation server.
Are the token counts exact?+
OpenAI text counts use the matching local BPE encoding. Other providers are clearly labeled estimates unless they publish a deterministic local formula. Image counts use provider-published rules.
How do I count tokens in a PDF or Word document?+
Attach a text-based PDF or DOCX file and the browser extracts its readable text locally, then counts it with every selected provider model. Scanned or encrypted PDFs require OCR and are not supported.
Can I calculate image tokens and vision-model cost?+
Yes. Add a PNG, JPEG, WebP, or GIF. For supported vision models, the calculator reads its pixel dimensions locally and applies the provider-published image token formula. It reports unavailable instead of inventing a value when a provider has no documented rule.
Why can the API report a slightly different count?+
Providers can add message wrappers, system instructions, tools, or model-specific processing. The accuracy badge and methodology explain what this calculator includes.