Token Calculator for LLMs
Free AI token counter for GPT-5 class models, Claude Opus, Gemini, and other LLMs—estimate context length and API usage before you ship.
How to Use
Paste your text
Paste or type prompts, system messages, or API payloads into the text area. Everything runs locally in your browser—nothing is uploaded.
View token count
Token counts use the same family of byte-pair encodings as modern OpenAI chat models (o200k_base), giving a strong estimate for English and mixed text.
Compare API costs
Multiply tokens by your provider’s per-1K rates for GPT-5.x, Claude Opus, Gemini, or other LLMs. Check each vendor’s pricing page for the latest numbers.
Optimize your prompts
Watch words and tokens together. Shorter system prompts, fewer examples, and tighter instructions usually reduce cost and latency.
Understanding tokenization
Large language models do not read characters the way humans do. Instead, a tokenizer splits text into tokens—short fragments that map to integers the neural network can process. The same sentence can produce different token counts on different families of models because each vendor may use its own vocabulary and merge rules.
For OpenAI-style chat models, BPE encodings such as cl100k and o200k are widely used. WiseCrew’s calculator uses o200k_base, which tracks closely with GPT-4o-era tokenization for everyday English and code. That makes it a practical universal tokenizer estimate when you are designing prompts or comparing rough costs across providers—always confirm with the exact model you bill against when precision is critical.
A rough rule of thumb is that one token is about 4 characters or ¾ of a word in English, but short words, numbers, and emojis can deviate. For high-stakes budgeting, combine this tool with your API dashboard.
Word-to-Token Conversion Guide
Token counts vary significantly based on content type and language. Use this reference to estimate token usage before running your text through the calculator.
| Content Type | Example | Ratio | 1000 Words ≈ | Notes |
|---|---|---|---|---|
| English Text | Hello world | ~1.3 tokens/word | ~1,300–1,500 | Standard prose averages ~1.3 tokens per word. |
| Code (Python/JS) | def func(): | ~2–3 tokens/word | ~2,000–3,000 | Symbols, operators, and syntax increase token count. |
| Chinese/Japanese | 你好世界 | ~2+ tokens/char | ~2,000+ | CJK characters often split into multiple tokens. |
| Technical Writing | API endpoint | ~1.5 tokens/word | ~1,500–1,800 | Technical terms and abbreviations vary. |
| JSON/XML Data | {"key":"value"} | ~3–4 tokens/word | ~3,000–4,000 | Structural characters add significant overhead. |
Compare Token Costs
Compare API pricing across major LLM providers. Prices shown are per 1 million tokens. The calculated prices below reflect the cost for your current input text.
| Model | Provider | Context | Input/1M Tokens | Input(Cached)/1M Tokens | Output/1M Tokens | Input Price | Input(cached) Price | Output Price |
|---|---|---|---|---|---|---|---|---|
| GPT-5.4 | OpenAI | 1M | $2.50 | $0.25 | $15.00 | $0.00 | $0.00 | $0.00 |
| GPT-5 mini | OpenAI | 400K | $0.25 | $0.03 | $2.00 | $0.00 | $0.00 | $0.00 |
| Claude Opus 4.6 | Anthropic | 200K | $5.00 | $0.50 | $25.00 | $0.00 | $0.00 | $0.00 |
| Claude Opus 4.5 | Anthropic | 200K | $5.00 | $0.50 | $25.00 | $0.00 | $0.00 | $0.00 |
| Claude Sonnet 4.6 | Anthropic | 200K | $3.00 | $0.30 | $15.00 | $0.00 | $0.00 | $0.00 |
| Claude Sonnet 4.5 | Anthropic | 200K | $3.00 | $0.30 | $15.00 | $0.00 | $0.00 | $0.00 |
| Claude Sonnet 4 | Anthropic | 200K | $3.00 | $0.30 | $15.00 | $0.00 | $0.00 | $0.00 |
| Claude Haiku 4.5 | Anthropic | 200K | $1.00 | $0.10 | $5.00 | $0.00 | $0.00 | $0.00 |
| Claude Haiku 3.5 | Anthropic | 200K | $0.80 | $0.08 | $4.00 | $0.00 | $0.00 | $0.00 |
| Gemini 3 Pro (Preview) | 1M | $2.00 | $0.20 | $12.00 | $0.00 | $0.00 | $0.00 | |
| Gemini 3 Flash (Preview) | 1M | $0.50 | $0.05 | $3.00 | $0.00 | $0.00 | $0.00 | |
| Gemini 2.5 Pro | 2M | $1.25 | $0.13 | $10.00 | $0.00 | $0.00 | $0.00 | |
| Gemini 2.5 Flash | 1M | $0.30 | $0.03 | $2.50 | $0.00 | $0.00 | $0.00 | |
| Gemini 2.5 Flash-Lite | 1M | $0.10 | $0.01 | $0.40 | $0.00 | $0.00 | $0.00 | |
| Gemini 2.0 Flash | 1M | $0.10 | $0.03 | $0.40 | $0.00 | $0.00 | $0.00 | |
| Gemini 2.0 Flash-Lite | 1M | $0.08 | $0.00 | $0.30 | $0.00 | $0.00 | $0.00 |
Pricing changes frequently. Treat this as a quick estimator and verify current rates in your provider dashboard. “Cached input” applies only if your provider supports prompt caching.
FAQ
Have more questions? Contact us