LLM Token Counter
Estimated Token Counts
Estimates based on average characters per token. Actual counts vary with content.
Estimated Cost (for this text as input)
| Model ↕ | Est. Tokens | Input Cost ↑ | Output Cost ↕ |
|---|---|---|---|
| GPT-5.5 | ~0 | $0.0000 | $0.0000 |
| GPT-5.5 Pro | ~0 | $0.0000 | $0.0000 |
| GPT-5.4 | ~0 | $0.0000 | $0.0000 |
| GPT-5.4 Pro | ~0 | $0.0000 | $0.0000 |
| GPT-5.4 Mini | ~0 | $0.0000 | $0.0000 |
| GPT-5.4 Nano | ~0 | $0.0000 | $0.0000 |
| GPT-5.3-Codex | ~0 | $0.0000 | $0.0000 |
| GPT-5.2 | ~0 | $0.0000 | $0.0000 |
| GPT-5.1 | ~0 | $0.0000 | $0.0000 |
| GPT-5 | ~0 | $0.0000 | $0.0000 |
| GPT-5-mini | ~0 | $0.0000 | $0.0000 |
| GPT-5-nano | ~0 | $0.0000 | $0.0000 |
| o3 | ~0 | $0.0000 | $0.0000 |
| o3-pro | ~0 | $0.0000 | $0.0000 |
| o4-mini | ~0 | $0.0000 | $0.0000 |
| o3-mini | ~0 | $0.0000 | $0.0000 |
| GPT-4.1 | ~0 | $0.0000 | $0.0000 |
| GPT-4.1-mini | ~0 | $0.0000 | $0.0000 |
| GPT-4.1-nano | ~0 | $0.0000 | $0.0000 |
| Claude Fable 5 | ~0 | $0.0000 | $0.0000 |
| Claude Opus 4.8 | ~0 | $0.0000 | $0.0000 |
| Claude Opus 4.7 | ~0 | $0.0000 | $0.0000 |
| Claude Opus 4.6 | ~0 | $0.0000 | $0.0000 |
| Claude Opus 4.5 | ~0 | $0.0000 | $0.0000 |
| Claude Opus 4.1 | ~0 | $0.0000 | $0.0000 |
| Claude Sonnet 4.6 | ~0 | $0.0000 | $0.0000 |
| Claude Sonnet 4.5 | ~0 | $0.0000 | $0.0000 |
| Claude Haiku 4.5 | ~0 | $0.0000 | $0.0000 |
| Claude Sonnet 4 | ~0 | $0.0000 | $0.0000 |
| Gemini 3.1 Pro | ~0 | $0.0000 | $0.0000 |
| Gemini 3.5 Flash | ~0 | $0.0000 | $0.0000 |
| Gemini 3 Flash | ~0 | $0.0000 | $0.0000 |
| Gemini 3.1 Flash-Lite | ~0 | $0.0000 | $0.0000 |
| Gemini 2.5 Pro | ~0 | $0.0000 | $0.0000 |
| Gemini 2.5 Flash | ~0 | $0.0000 | $0.0000 |
| Gemini 2.5 Flash-Lite | ~0 | $0.0000 | $0.0000 |
| Grok 4.3 | ~0 | $0.0000 | $0.0000 |
| Grok 4.20 | ~0 | $0.0000 | $0.0000 |
| Grok Build 0.1 | ~0 | $0.0000 | $0.0000 |
| DeepSeek V4 Flash | ~0 | $0.0000 | $0.0000 |
| DeepSeek V4 Pro | ~0 | $0.0000 | $0.0000 |
| Mistral Medium 3.5 | ~0 | $0.0000 | $0.0000 |
| Mistral Large 3 | ~0 | $0.0000 | $0.0000 |
| Mistral Medium 3.1 | ~0 | $0.0000 | $0.0000 |
| Mistral Small 4 | ~0 | $0.0000 | $0.0000 |
| Llama 4 Scout (Groq) | ~0 | $0.0000 | $0.0000 |
Prices per 1M tokens. Input cost = cost if this text is sent as input. Output cost = cost if this text were generated as output. Data as of August 09, 2026.
Quick Cost Calculator
What This Tool Does
You can count tokens for GPT-5 and Claude prompts offline with this token counter. It estimates token counts entirely in your browser using calibrated characters-per-token ratios — about 4.0 characters per token for GPT-family models and 3.5 for Claude — so no prompt text is ever sent to a server. For billing-exact numbers, verify with the provider's official tokenizer; for fast, private estimates across many models at once, use this.
Last updated:
This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.
Programmatic Access
LLM Token Counter is also callable as a free HTTP JSON API at
https://aidevhub.io/api/token-counter/ — GET with query
parameters or POST with a JSON body, no authentication, CORS enabled,
50 requests/day per IP. Responses return
{ ok, tool, result, meta }.
curl -s "https://aidevhub.io/api/token-counter/?text=Hello%20world"
Machine-readable contract: /api/tool/token-counter.json All API endpoints: /agents/ LLM site index: /llms.txt
Agent Invocation
Best Path For Builders
Dedicated API endpoint
Deterministic outputs, machine-safe contracts, and production-ready examples.
Dedicated API
https://aidevhub.io/api/token-counter/ OpenAPI: https://aidevhub.io/api/openapi.yaml
Unified Runtime API
https://aidevhub.io/api/tools/run/?toolId=token-counter&a=...
GET and POST are supported at /api/tools/run/ with identical validation and limits.
Limit: 10 req / 60s, input max 512 KB.
REST API
Base URL
https://aidevhub.io/api/token-counter/ 50 requests/day per IP. No authentication required. CORS enabled. OpenAPI spec
Endpoints
Example
curl "https://aidevhub.io/api/token-counter/?text=Hello+world"
Example Response
{
"text_length": 13,
"tokens": {
"gpt-4o": {
"model": "gpt-4o",
"tokens": 4,
"method": "estimate",
"cost": {
"input": 0.00001,
"output": 0.00004
}
}
},
"model_count": 32
} How to Use LLM Token Counter
- 1
Paste text to count
Paste any content: prompt text, article, code snippet, or conversation. The tool counts tokens using the actual tokenizer for each model.
- 2
Select your target model
Choose from GPT, Claude, Gemini, Llama, and others. Token counts vary by model due to different tokenizers.
- 3
See token estimate and cost breakdown
Get total token count, approximate cost at current pricing, and cost per 1M tokens. Useful for budgeting API calls.
- 4
Count multiple texts in batch
Paste multiple prompts or messages separated by '---'. Get individual counts and total across all inputs.
- 5
Test text reduction strategies
Use the counter to compare token usage before and after shortening. Remove redundant words or summarize to optimize API costs.
Frequently Asked Questions
What is LLM Token Counter?
How do I use LLM Token Counter?
Why do token counts differ between models?
How do I count tokens for GPT and Claude prompts with an offline tokenizer?
Paste your prompt into the counter above. It computes character and word counts, then estimates tokens per model family using the characters-per-token ratios below — all in the browser, with no API call and no network dependency after the page loads. This matters when prompts contain confidential material, or when you need counts inside an offline or air-gapped workflow.
Characters-per-token ratios by model family
| Model family | Characters per token | Est. tokens per 1,000 characters |
|---|---|---|
| GPT | 4.0 | ~250 |
| Claude | 3.5 | ~286 |
| Gemini | 4.0 | ~250 |
| DeepSeek | 4.0 | ~250 |
| Mistral | 4.0 | ~250 |
| Llama | 4.0 | ~250 |
| Grok | 4.0 | ~250 |
Ratios apply to typical English prose; data as of August 09, 2026. A practical consequence: the same prompt usually produces more tokens on Claude (3.5 chars/token) than on GPT-family models (4.0 chars/token).
How accurate is a ratio-based token estimate?
A characters-per-token ratio is an estimate, not a byte-pair-encoding run. It is closest for plain English text and drifts for source code, dense punctuation, non-Latin scripts, and unusual whitespace, where real tokenizers split text differently. Use ratio estimates for sizing prompts, comparing models, and budgeting; use the provider's own tokenizer when you need billing-exact counts.
When do I need an exact count instead?
- Enforcing hard context-window limits, where an overshoot causes a request to be rejected or silently truncated.
- Metering or invoicing customers on token usage.
- For OpenAI models, run the open-source tiktoken library locally; for Anthropic models, call the count-tokens endpoint of the API.
- For everything before that point — drafting, comparing, budgeting — a client-side estimate is faster and keeps the prompt on your machine.