Prompt Token Counter

Paste your prompt: token counts, context usage, and input cost for 37 AI models update instantly. Prices pulled from live data, updated daily. Nothing leaves your browser.

ZERO UPLOAD · ALL LOCAL
  1. Paste your prompt or system instruction into the text box. All 37 models update instantly.
  2. The TOKENS column shows exact counts for OpenAI, DeepSeek, Qwen, and Claude; other providers use a fast approximation marked with ~.
  3. INPUT $ shows what that prompt costs to send at each provider's current rate.
  4. OUT $/M is the per-million-token output rate; multiply by your expected reply length to estimate the full round-trip cost.
  5. The context bar turns amber at 75% and red at 95%, warning you that you're approaching the model's limit.

Pre-filled for this page

The input below is pre-filled with tokenization_qwen3_5.py, the example this page refers to, so you can see its exact token count.

What to look for

  • GPT-5.5 at 1.1M tokens
  • Claude Haiku 4.5 at 200K tokens
  • 95% of the model's context window
  • at least 20% headroom left after the assembled prompt

The context window is shared between input and output tokens; a long input directly shrinks the room left for the model's response.

Pre-filled for this page

The input below is pre-filled with running, the example this page refers to, so you can see its exact token count.

What to look for

  • 3x to 6x more expensive per token
  • 5x ($5 input, $25 output)
  • 6x ($5 input, $30 output), the highest covered here
  • 20-50 representative requests

Use the 90th percentile of sampled output length for cost planning, not the mean; tail-heavy generation tasks make mean-based estimates produce billing surprises.

Output (Token counts)

35 models · prices updated 15th September 2026

MODEL
TOKENS
CONTEXT
INPUT $
OUT $/M
ANTHROPIC Claude Opus 5
$25.00/M
ANTHROPIC Claude Sonnet 5
$10.00/M
ANTHROPIC Claude Haiku 4.5
$5.00/M
ANTHROPIC Claude Fable 5
$50.00/M
GOOGLE Gemini 3.5 Flash-Lite
$2.50/M
GOOGLE Gemini 3.1 Pro Preview
$12.00/M
GOOGLE Gemini 3.6 Flash
$7.50/M
OPENAI GPT-5.6 Sol
$30.00/M
OPENAI GPT-5.6 Terra
$15.00/M
OPENAI GPT-5.6 Luna
$6.00/M
DEEPSEEK DeepSeek V4 Pro
$0.87/M
DEEPSEEK DeepSeek V4 Flash
$0.28/M
KIMI Kimi K3
$15.00/M
KIMI Kimi Moonshot 128K
$5.00/M
MINIMAX MiniMax M2.7 Fast
$2.40/M
MINIMAX MiniMax M3
$1.20/M
QWEN Qwen3 235B
$0.88/M
QWEN Qwen Max
$6.40/M
QWEN QwQ 32B
$0.20/M
QWEN Qwen3.6 35B
$2.00/M
QWEN Qwen3.5 397B
$3.60/M
XAI Grok 4
$15.00/M
XAI Grok 4.5
$6.00/M
XAI Grok Code Fast
$1.50/M
Z.AI GLM-5
$2.48/M
Z.AI GLM-5.2
$3.86/M
XIAOMI MiMo V2 Flash
$0.30/M
MISTRAL Mistral Large
$1.50/M
MISTRAL Devstral 2 123B
$2.00/M
AMAZON Nova Premier
$12.50/M
AMAZON Nova Pro
$3.20/M
NOUSRESEARCH Hermes 4
$3.00/M
NVIDIA Nemotron 70B
$0.30/M
NVIDIA Nemotron 3 Super 120B
$0.75/M
PERPLEXITY Sonar Pro
$15.00/M

~ approximation: exact tokenizer unavailable offline. Out $/M = rate per 1M output tokens.

What is tokenization?

AI language models don't read text character by character. Instead, they split text into tokens: chunks that are usually a word, a punctuation mark, or a common sub-word sequence.1 A word like "tokenization" might be one token in a large modern vocabulary, but in an older or smaller vocabulary the same word might split into "token" and "ization", producing two tokens instead of one. The exact split depends on the training data and vocabulary size of each model's tokenizer.2

The tokenizer itself

Behind that process sits a component with a name of its own. The tokenizer is the piece of software that turns your request text into the token sequence the model actually reads, and it ships with a fixed vocabulary built during training. Because the vocabulary is fixed, one model splits the same text the same way every time, while a different model's tokenizer often splits it differently, which is why a token count is always a per-model fact rather than a property of the text itself. That is the reason this grid lays one prompt against 37 models instead of producing a single authoritative number, and the reason a count quoted without its model is nearly meaningless.

This component distinction explains the ~ markers on several rows. Because an exact count requires the provider's tokenizer as runnable code, and not every provider publishes one that runs inside a browser, the grid divides your pasted characters by 3.8 for those models and marks the result approximate. The division lands close for typical English prose, which makes it safe for a rough size check and unsafe for a budget decision. When a number feeds into cost planning or a context-window fit, trust the exact rows first, and read the marked rows as a floor rather than a promise.

Why tokens are the billing unit

Tokens are the billing unit for every major AI API, which is why the counter matters as much as the model you pick. At the API level, the context window (the maximum amount of text a model can hold in memory at once) is also measured in tokens rather than characters or words, so both cost and capacity are tracked in the same unit. A 1M-token context window sounds enormous, yet a single dense research paper can exceed 100K tokens once references, tables, and formatting are included.

Because providers bill per token, the same prompt can cost dramatically different amounts depending on how aggressively a model's tokenizer splits it, and that difference compounds across every request in a high-volume pipeline. Counting before you send gives you a hard number to plug into cost estimates instead of relying on rough character-based guesses that often undercount by 30 percent or more.

A short sentence makes the count concrete. Pasting The quick brown fox jumps over the lazy dog. into the box produces exactly 10 tokens for GPT-5.6's o200k_base tokenizer, close to but not identical to the 9-word count a naive split would give you. That gap between word count and token count is the whole reason a dedicated counter exists instead of a rough character-division guess.

For a usable rule of thumb, plain English prose runs roughly four characters per token, the same calibration family behind this tool's approximate rows. OpenAI's own token guidance gives the estimate directly: one token is approximately four characters, and 100 tokens approximately 75 words, so a 1,000-character passage lands near 260 tokens and a 500-word document near 650 to 700.3 Treat those figures as planning numbers, not guarantees. Sentence length and vocabulary shift the ratio from one text to the next, which is exactly why the paste box exists: instead of multiplying character counts by a guess, you get the exact split for every model in the grid at once.

The rule holds only for prose. Because code and markup split on symbol density rather than word shape, dense source carries more tokens per character than an English paragraph of the same length, and formatting characters are not free either: Markdown fences, XML tags, and JSON braces are all tokens in their own right. A rough character count can therefore understate a code-heavy prompt badly. Use the estimate for sizing drafts and rough budgets, and switch to the exact rows whenever the number has to be right, because the paste box prices the real text rather than the idealized one.

Why count before the API call?

The only reliable place to count tokens is client-side, before the request. Once the request is sent, the model's usage field in the response tells you how many tokens were consumed, but by that point you've already paid and potentially hit a context limit.4 For pipelines that process thousands of prompts, knowing the token count before sending lets you route shorter prompts to cheaper models, reject oversized inputs before they cause API errors, and estimate batch costs accurately.4

You cannot ask an AI to count its own tokens before the request is sent. The model has no knowledge of how many tokens it will use until it processes the input. This tool counts tokens locally using the same libraries the APIs themselves use (tiktoken for OpenAI) or close equivalents, so the counts you see match what the API bills.

Not every input matches the calibration. The ~ rows divide characters by 3.8, a ratio tuned to typical English prose, and two kinds of paste knock it off. In code, symbols and identifiers split into small pieces, so the same character count carries more tokens than an English paragraph would. With other languages, the relationship between characters, words, and tokens shifts as well3, so text written without Latin letters or without spaces can drift well past the estimate. For either input, read the exact-tokenizer rows as the trustworthy numbers and treat every ~ value as a floor.

TIP Disconnect from the internet after the page finishes loading and the tool keeps working, because every tokenization call runs locally in your browser rather than on a remote server. Your prompt text never leaves the browser tab, so you can audit sensitive prompts with confidence that nothing is being uploaded.

This counter reads pasted text and nothing else. It accepts no files and no images, and a multimodal request's image portion is billed by the provider as its own token quantity, derived from the image's size and the detail level you choose rather than from anything a text box could hold.5 For an image-bearing prompt, the practical path splits in two: count the text portion here, then read the image input pricing from the provider's own documentation for the specific model, where the per-image cost is laid out directly. No text-paste count can stand in for that number.

Reading the context bar

The CONTEXT column shows two things: what percentage of the model's context window your prompt occupies, and a color-coded bar. Green means the prompt fits comfortably. At 75%, the bar turns amber, signaling that you're leaving little room for the model's response. It turns red at 95%, indicating you're near the hard limit; the API may reject the request or silently truncate your input.

How context windows shape the bar

Context windows vary enormously across the 37 models shown: Claude Haiku 4.5 tops out at 200K tokens while GPT-5.6 Sol allows about 1.05M.67 That gap means a prompt that barely registers on one model can blow past the limit of another, which is exactly why the context bar is per-model rather than a single number. When a prompt is too long for a particular provider, the grid lets you see at a glance which alternative models still have headroom, so you can decide whether to trim or to switch before committing to an API call.

What happens at the limit

Two different failures hide behind a full context bar. Through an API, the provider rejects an oversized request with an error before the model processes anything, so the model generates nothing and you must trim or split the input before resending.8 Inside chat products, the same overflow usually never surfaces at all: the interface quietly drops the oldest turns so the newest still fit, which trades an error message for a conversation whose early history has simply drifted out of view. The bar exists so you learn which shape you are heading toward before sending, and the red band begins at 95 percent rather than 100 for a reason: the model's reply needs window space of its own.

The window itself is not the only ceiling. Alongside it, providers publish a maximum output-tokens figure for each model, a separate limit on how long any single reply can run, and this grid's CONTEXT column never reports it because the column scopes to the prompt you paste against the input window only.6 Reply-length planning therefore belongs in your own estimate rather than in the bar. A prompt resting comfortably in the green can still collide with the output cap when you ask for a long generation, so before committing a request that needs a long reply, check the model's output limit in the provider's documentation alongside its window.

Why prices differ between providers

Model pricing reflects compute cost, model size, and competitive positioning. Frontier models like Claude Opus 5 and GPT-5.6 Sol charge $4 to $5 per million input tokens because they run on large, expensive hardware.910 Smaller or distilled models like Gemini 3.5 Flash-Lite ($0.30/M input, $2.50/M output) trade some capability for dramatically lower cost.11 For tasks that don't need top-tier reasoning, such as summarization, classification, and structured extraction, a cheaper model for the bulk of processing can reduce costs by 10x or more.

The INPUT $ column shows only what it costs to send your prompt, but that is only half the bill. The OUT $/M column is the per-million-token rate charged for the model's response, and for most conversational workloads output tokens run 3 to 6 times more expensive than input tokens, so a long reply can easily cost more than the prompt that triggered it. Multiplying the output rate by your expected reply length and adding the input cost gives you a realistic per-request estimate before you spend a cent.11

Input tokens versus output tokens

Input tokens and output tokens name the two halves of every request. On the input side sits everything the request carries: your system prompt, the whole visible conversation, any tool results, and the new user turn. Output is what the model generates in reply. Because a chat request submits its full thread as input on every turn, the input side of a long conversation grows with each message you add, and every new turn re-bills the turns already behind it.8 That re-entry is why token awareness pays as a habit rather than a one-time check, and why a counter belongs on your desk before the request rather than in your logs after it.

The split also prices your conversation history. Because output rates sit at 3 to 6 times their matching input rates, a long reply can outcost its own prompt, and the accumulated thread bills as input again on every turn that follows. The grid gives you half that arithmetic exactly: paste the prompt and INPUT $ prices it, while OUT $/M waits for your expected reply length. Your estimate of how much the model will say back is the only missing number, and for multi-turn work, the full conversation is the honest thing to paste.

Prices in this tool are pulled automatically from pydantic/genai-prices, an open-source AI pricing database maintained by the Pydantic team and the community, and refresh at least once per day so the numbers stay current as providers adjust their rates. Because the data comes from a public repository rather than a private integration, you can verify any figure against the source. Thank you to everyone contributing to that project.

Prompt structure and token efficiency

Formatting choices affect token count more than most developers expect. Markdown characters, XML tags used for structure, verbose phrasing, and repeated context all add tokens that cost money on every request. System prompts are charged on every API call. A 500-token system prompt across 10,000 requests costs 5 million input tokens for the system prompt alone, at whatever rate applies to that model.12 Auditing your system prompt for repetition and trimming verbose instructions is one of the highest-leverage cost optimizations available for high-volume AI applications.

Turning token awareness into a workflow habit

When your context bar turns red, the fastest fix is usually removing repeated context, shortening instructions, or summarizing earlier conversation turns rather than switching to a more expensive model with a larger window. Counting tokens before the API call, rather than discovering the limit through an error response, is the habit that separates stable production deployments from fragile ones. CapyToolkit runs all tokenization locally in your browser so you can audit prompt structure without sending any content to a server.

Context Bar Threshold Reference

  • Comfortably under the context window
  • 75% of the context window
  • 95% of the context window

Paste your own prompt above and watch which color each model's context bar turns.

Sources
  1. 1.

    Hugging Face, "Tokenization algorithms," huggingface.co, accessed June 2026. https://huggingface.co/docs/transformers/main/tokenizer_summary

  2. 2.

    OpenAI, "tiktoken," github.com, accessed June 2026. https://github.com/openai/tiktoken

  3. 3.

    OpenAI, "Understanding and counting tokens," help.openai.com, accessed September 2026. https://help.openai.com/en/articles/4936856

  4. 4.

    OpenAI, "Counting tokens | OpenAI API," developers.openai.com, accessed June 2026. https://developers.openai.com/api/docs/guides/token-counting

  5. 5.

    OpenAI, "Images and vision | OpenAI API," platform.openai.com, accessed September 2026. https://platform.openai.com/docs/guides/images-vision

  6. 6.

    Anthropic, "Models overview | Claude API Docs," platform.claude.com, accessed June 2026. https://platform.claude.com/docs/en/about-claude/models/overview

  7. 7.

    LLM Stats, "AI Leaderboard: Compare & Rank AI Models by Intelligence, Speed & Price," llm-stats.com, accessed June 2026. https://llm-stats.com/

  8. 8.

    Anthropic, "Context windows - Claude Platform Docs," docs.anthropic.com, accessed September 2026. https://docs.anthropic.com/en/docs/build-with-claude/context-windows

  9. 9.

    Anthropic, "Pricing | Claude API Docs," platform.claude.com, accessed June 2026. https://platform.claude.com/docs/en/about-claude/pricing

  10. 10.

    OpenAI, "Pricing | OpenAI API," developers.openai.com, accessed June 2026. https://developers.openai.com/api/docs/pricing

  11. 11.

    Google, "Gemini Developer API pricing," ai.google.dev, accessed June 2026. https://ai.google.dev/gemini-api/docs/pricing

  12. 12.

    Anthropic, "Token counting | Claude API Docs," docs.anthropic.com, accessed June 2026. https://docs.anthropic.com/en/docs/build-with-claude/token-counting

FAQ