LLM Token Counter for GPT, Claude & Gemini Prompts
Paste a prompt to estimate token count, API cost, and context-window usage across current GPT-5.6, Claude 5/4.8/4.5, and Gemini 3.5/3.1 models. This browser-based heuristic is useful for planning; provider tokenizers remain the source of truth.
Tokens (est.)
52
Coarse planning heuristic
Characters
159
Words
27
UTF-8 bytes
159
| Model | Input cost | Output cost | Total | Context use |
|---|---|---|---|---|
GPT-5.6 Sol OpenAI · 1.05M context · $5/$30 per 1M Official model or pricing source | $0.000260 | $0.009000 | $0.009260 | 0.00% |
GPT-5.6 Terra OpenAI · 1.05M context · $2.5/$15 per 1M Official model or pricing source | $0.000130 | $0.004500 | $0.004630 | 0.00% |
GPT-5.6 Luna OpenAI · 1.05M context · $1/$6 per 1M Official model or pricing source | $0.000052 | $0.001800 | $0.001852 | 0.00% |
Claude Fable 5 Anthropic · 1M context · $10/$50 per 1M Official model or pricing source | $0.000520 | $0.0150 | $0.0155 | 0.01% |
Claude Opus 4.8 Anthropic · 1M context · $5/$25 per 1M Official model or pricing source | $0.000260 | $0.007500 | $0.007760 | 0.01% |
Claude Sonnet 5 Anthropic · 1M context · $2/$10 per 1M Official model or pricing sourceIntroductory rate through Aug 31, 2026; $3/$15 starts Sep 1. | $0.000104 | $0.003000 | $0.003104 | 0.01% |
Claude Haiku 4.5 Anthropic · 200K context · $1/$5 per 1M Official model or pricing source | $0.000052 | $0.001500 | $0.001552 | 0.03% |
Gemini 3.5 Flash Google · 1.049M context · $1.5/$9 per 1M Official model or pricing source | $0.000078 | $0.002700 | $0.002778 | 0.00% |
Gemini 3.1 Flash-Lite Google · 1.049M context · $0.25/$1.5 per 1M Official model or pricing source | $0.000013 | $0.000450 | $0.000463 | 0.00% |
One rough, character-based estimate is used across every row. Real token counts vary by model, tokenizer version, message framing, tools, and content type. Never use this result as a billing record; confirm the exact request with the provider's token-counting API or tokenizer.
What this token counter includes
Instant Token Estimate
Type or paste prompt text and the token count updates as you type. No submit, no API call, no waiting.
Source-Linked Cost Estimate
Compare input and output estimates for nine current models using dated list prices linked to official provider sources.
Context Window Bar
See the estimated share of each listed context window, from 200K for Claude Haiku 4.5 to roughly 1M for the other models.
100% Client-Side
Your prompts never leave the browser. No fetch, no API key required. Works offline once the page is loaded.
LLM Token Counter: Estimate Prompt Tokens & API Cost
A token counterestimates how many tokens a prompt costs before you send it to an LLM API. Paste text and this tool returns an estimated token count, the input and output cost in USD, and the share of each model's context window your prompt fills — across GPT-5.6 Sol, Terra, and Luna; Claude Fable 5, Opus 4.8, Sonnet 5, and Haiku 4.5; plus Gemini 3.5 Flash and 3.1 Flash-Lite. Prompt text is processed in your browser.
How to count tokens in a prompt
- Paste or type your prompt into the textarea — the token, character, word, and byte counts update as you type, with no submit and no API call.
- Read the source-linked cost table to compare the listed standard input and output rates.
- Drag the expected-response-length slider to create a rough end-to-end projection.
- Check the context-window bar, while reserving space for output, tools, attachments, and provider-added framing.
- Before relying on a hard limit or budget, count the exact request with the provider's tokenizer or token-counting API.
What is a token, and why do counts differ between models?
A tokenis a model-readable text unit, not a fixed number of characters or words. Tokenizers can represent common fragments compactly and split rarer text, code, numbers, or other scripts differently. A rough English-prose planning range is 3–5 characters per token, but it should not be treated as a model specification.
The same text gets different counts because providers and model versions can use different vocabularies and request formats. Anthropic, for example, documents a newer tokenizer for Claude Opus 4.7 and later that can produce more tokens for the same text than earlier Claude models. OpenAI publishes its tiktoken repository, while provider APIs remain the authority for a specific production request.
This tool is a transparent heuristic, not a vocabulary-driven tokenizer. It estimates alphabetic words, digit runs, whitespace, and punctuation with simple rules, then applies that one estimate to every pricing row. That makes it useful for quick comparisons, but unsuitable for invoices, rate-limit enforcement, or prompts close to a context boundary.
Worked examples: text → estimated tokens
Short English sentence
"The quick brown fox jumps over the lazy dog." → ~10 tokens (44 chars, 9 words)
A long number
"1234567890" → ~4 tokens (10 digits, split into ~3-digit runs — not 1 token)
Source code
"const x = arr.map((i) => i * 2);" → denser than prose; symbols and operators each cost tokens
Edge case · chat-message framing
This tool counts the text body only. A production request can also include roles, separators, system instructions, tool definitions, reasoning tokens, media, and other provider-specific framing. Count the serialized request through the relevant provider before setting a hard budget.
Token density by content type
These broad planning ranges help explain why equal character counts can produce different token estimates. Actual density depends on the exact model, tokenizer version, language, and request format.
| Content Type | Typical Density | Notes |
|---|---|---|
| English prose | ~3-5 chars/token | A planning rule only; vocabulary, whitespace, and model version change the result. |
| Code (Python, JS) | ~2-4 chars/token | Identifiers, operators, and indentation often make code denser than prose. |
| CJK languages | Highly variable | Do not reuse an English character ratio for Chinese, Japanese, or Korean text. |
| JSON / structured | ~2-4 chars/token | Keys, quotes, brackets, and separators all affect tokenization. |
| Numbers | Model-dependent | Long digit sequences can split differently across tokenizer versions. |
Token budget by prompt component
| Component | Typical Range | Notes |
|---|---|---|
| System prompt | 500-2,000 tokens | A planning range; repeated instructions count toward input unless caching applies. |
| User message | 50-5,000 tokens | Short questions and document-heavy requests have very different requirements. |
| Assistant response | 100-2,000 tokens | Set an explicit output limit that fits the task and provider API. |
| Few-shot examples | 500-5,000 tokens | Keep only examples that measurably improve the result. |
| Retrieved chunks (RAG) | 500-50,000 tokens | Retrieve the smallest evidence set that still answers the request. |
Total prompt cost = input tokens × input rate + output tokens × output rate. In this dated model snapshot, listed output rates are 5–6× the listed input rates. Discounts and nonstandard processing modes are not included.
The pricing trap most cost calculators miss
Input and output rates are separate. In the July 11, 2026 snapshot, GPT-5.6 Sol lists $5/1M input and $30/1M output; Claude Opus 4.8 lists $5/1M input and $25/1M output. OpenAI also lists a higher rate for GPT-5.6 prompts above 272K input tokens, which this calculator applies when the rough estimate crosses that threshold. The response-length slider prevents input pricing from being applied to the entire request.
Language and content shape are another source of error. An English-prose character ratio should not be reused for source code, structured data, or other scripts. Test representative production inputs with the exact model tokenizer before choosing a budget.
How to lower token cost
Compress system prompts
Remove duplicated or ineffective instructions after evaluating that output quality and safety remain intact.
Cap response length
Set the provider's current output-token limit and ask for the shortest format that still completes the task.
Cache static context
Where supported, compare prompt-caching requirements and rates for repeated prefixes against normal input pricing.
Right-size the model
Evaluate a lower-cost model on your real quality, latency, and safety requirements before moving production traffic.
Prompt calculation stays in your browser
The prompt calculation — token estimate, cost, byte count, and context-window bar — runs in JavaScript in your tab and does not call an LLM or token-counting service. Normal requests needed to load the page and any site analytics are separate; review the privacy notice for those site-level details.
Frequently asked questions
Is this LLM token counter free?
Yes. This tool is free to use with no signup or API key. The estimate, cost comparison, and context bars are calculated in your browser.
How accurate is the token estimate?
It is a coarse planning estimate, not an implementation of any provider tokenizer. The difference can be material for code, numbers, non-Latin text, short inputs, tools, and message wrappers. Use the exact provider tokenizer or token-counting API for billing and hard context limits.
Are input and output tokens priced the same?
No. Every model currently listed charges a higher standard rate for output than input. The comparison keeps the two amounts separate and links each row to the provider source reviewed on July 11, 2026.
How large are the listed context windows?
GPT-5.6 Sol, Terra, and Luna list 1.05M-token context windows. Claude Fable 5, Opus 4.8, and Sonnet 5 list 1M; Claude Haiku 4.5 lists 200K. Gemini 3.5 Flash and 3.1 Flash-Lite list 1,048,576 input tokens. Always reserve room for the response and provider-added content.
Why can another token counter show a different result?
Models and model versions can use different tokenizers. Tools also differ on whether they count only the text body or include roles, separators, tool definitions, attachments, and other request framing. This page uses one transparent heuristic across every model row.
Is my prompt sent anywhere?
The counter processes prompt text in your browser and does not send it to a token-counting service. Normal page requests and any site analytics described in the privacy notice are separate from the text calculation.
Related developer & web tools
Count words, characters & sentences
JSON FormatterInspect API request/response bodies
JavaScript MinifierShrink code before pasting into a prompt
HTML FormatterTidy markup pasted into context
CSS MinifierCompress CSS to save prompt tokens
HTML Entity ConverterEncode & decode entities for clean text
HTML to JSXConvert markup for React snippets
Markdown TOCGenerate a table of contents
Meta Tag PreviewerPreview title & description tags
Open Graph GeneratorBuild OG social-share tags
Favicon GeneratorCreate multi-size favicons
Image CompressorShrink images in the browser
Guide: Open Graph Meta TagsRead the social-metadata guide
All ToolsBrowse the full Toolk hub
Pricing and model details reviewed: July 11, 2026 · Prompt calculations run locally in your browser.
Need a different tool?
Browse all 90 browser-based tools (90 currently marked free), or tell us what useful utility we should build next.