Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Token Counter

Paste any prompt, document or code and get an instant token estimate, the cost of sending it as input across popular models (Claude, GPT, Gemini, gpt-oss), and how much of each context window — 8K to 1M — it consumes. Tuned heuristics for prose vs code, no signup, nothing leaves your browser.

Content type
Heuristic estimate (±15%) — 1 token ≈ 4 chars of English ≈ ¾ of a word; code runs denser. Exact counts vary per tokenizer.
96Estimated tokensprose heuristic
70Words3 lines
1.37Tokens / wordEnglish prose ≈ 1.3
Context-window fit
8K (small)1.2%
32K0.3%
128K (gpt-oss-120B)0.1%
200K0%
1M (Claude, Gemini)0%
Cost to send once, as input
Model$ / 1M inputThis text
Claude Fable 5.1$10.00$0.000960
Claude Opus 5.5$4.00$0.000384
Claude Sonnet 5.5$2.00$0.000192
Claude Haiku 5.5$0.1000$0.000010
gpt-6.1-sol$2.00$0.000192
gpt-6.1-terra$1.00$0.000096
Gemini 3.1 Pro Preview$2.00$0.000192
Gemini 3.5 Flash-Lite$0.3000$0.000029
gpt-oss-120B$0.1500$0.000014

A language model never sees words or letters: its tokenizer splits text into sub-word pieces from a fixed vocabulary, and the model reads, writes, bills and limits everything in those pieces. This counter estimates how many tokens your text becomes, what sending it once costs as input, and how much of common context windows it fills.

What it computes

CJK      = count of Chinese, Japanese and Korean characters
rest     = everything else: characters c and words w
prose    = (c / 4 + w × 1.3) / 2
mixed    = c / 3.5
code     = c / 3
tokens   = CJK + round(estimate for the chosen type)
cost     = tokens / 1,000,000 × input price
fit      = tokens / window size
  • The prose rule averages the two classic heuristics, about 4 characters per token and about 1.3 tokens per word.
  • Words are runs of non-space characters, so a dash standing alone counts as one.
  • Prices are list prices per million input tokens for nine models as of 28 October 2026, the same table as the pricing comparator. Claude Haiku 5.5’s rate rises fivefold, to $0.50, once a prompt passes 100,000 tokens, and the tool applies it. Output tokens are not included.
  • Windows are 8K (8,192 tokens), 32K (32,768), 128K (128,000), 200K (200,000) and 1M (1,000,000); a bar reads “over” when the text alone exceeds it.

A worked example

The sample text has 401 characters, 70 words and 3 lines, with no CJK characters.

  1. Prose: 401 / 4 = 100.25 and 70 × 1.3 = 91; their average is 95.6, so the estimate is 96 tokens, or 1.37 tokens per word.
  2. Mixed: 401 / 3.5 = 114.6, so 115. Code: 401 / 3 = 133.7, so 134.
  3. Window fit at 96 tokens: 1.2% of 8K, 0.3% of 32K and 0.1% of 128K.
Model$ per 1M inputSending 96 tokens once
Claude Fable 5.1$10.00$0.000960
Claude Opus 5.5$4.00$0.000384
Claude Sonnet 5.5$2.00$0.000192
gpt-6.1-terra$1.00$0.000096
Claude Haiku 5.5$0.1000$0.000010

Those are fractions of a cent, but they recur on every call. The same 96 tokens sent as part of a million requests a month would cost $960 on Fable 5.1 and $9.60 on Haiku 5.5, as input alone.

Assumptions and limits

  • Heuristic, not a tokenizer. Real counts differ by model family and can be off by about 15% for ordinary text, and more for URLs, numbers, emoji and many non-Latin scripts.
  • You choose the content type. The tool does not detect code; pick Prose, Mixed or Code to match what you paste.
  • Input cost only. Output tokens, cached-input discounts and batch pricing are not included.
  • Text only. Images, files and tool-call wrappers that APIs add around messages also consume tokens.

How to use the result

  • Budget with margin. Treat the estimate as plus or minus 15% and keep prompts comfortably below hard limits.
  • Count the whole request. Paste the system prompt, tool definitions and typical history together, since all of it is billed on every call.
  • Multiply by volume. Cost per call times calls per month is the number that matters for a product.
  • Verify near limits with the target model’s own token-counting tool before shipping.
  • Pick the right content type. Switching the sample from Prose to Code raises the estimate from 96 to 134 tokens, a 40% swing, so choose the type that matches most of what you paste, and use Mixed for documents that interleave prose with code or data.

When to use it, and when not

Use the estimate when the question is about scale: is this prompt 2,000 tokens or 20,000, does a document fit 32K or need 128K, is a long system prompt worth trimming. At that resolution a 15% error never changes the decision. It is also a fast way to compare two drafts, because the error is roughly the same for both versions of the same kind of text.

Use the real tokenizer when the number is a contract: truncating text to a hard limit, setting a maximum output length close to the window, reconciling an invoice, or measuring text the rules of thumb handle badly. Every API response also reports the exact input and output token counts for that call, which is the ground truth for anything already in production.

Trade-offs and limits

Cost and window fit are both linear in the token count, so any error in the count passes straight through: a 15% undercount is a budget 15% too low and a window 15% fuller than shown. Beyond the tokenizer spread, a few simplifications push the estimate in a known direction:

The toolWhat really happensEffect
Counts every space as a characterMany tokenizers merge a run of spaces into one tokenDeeply indented code is over-counted
Counts only the text you pasteChat APIs wrap each message in role markers and separatorsA few extra tokens per message; adds up over long histories of short turns
One token per CJK characterTokenizers merge some common characters and split rare onesOff in either direction
One count for all nine modelsEach family has its own vocabularyThe cost column inherits that spread

Common mistakes

  • Budgeting in words. The sample’s 70 words are 96 tokens, 1.37 tokens a word. At that ratio a limit written as “2,000 words” is about 2,700 tokens of English prose, and more for code or numbers.
  • Checking the window against the text alone. The bars here read “over” only when the pasted text exceeds the window. A 7,000-token prompt shows 85% of 8K and looks safe, yet the reply has to fit in the 1,192 tokens left.
  • Truncating to the estimate. Cutting a document at exactly 8,192 estimated tokens can still overflow, because at ±15% the real count may be about 1,229 tokens higher. Leave that margin, or truncate with the model’s own tokenizer.
  • Sizing from the typical input. Retrieved documents, pasted logs and chat histories vary by request. Set limits from the longest realistic input, and use the typical one only for cost.
  • Pricing the input and stopping there. Output is billed separately, at 4 to 8.3 times the input price on every model in this tool’s table. The 96-token sample answered in 300 tokens on Claude Sonnet 5.5 costs $0.000192 in and $0.003 out: output is 94% of that call.

Check yourself

A 2,000-character Python file has 300 whitespace-separated words. What does the tool estimate as Code, and what if you leave it on Prose?

Code: 2,000 / 3 = 666.7, so 667 tokens. Prose: (2,000 / 4 + 300 × 1.3) / 2 = (500 + 390) / 2 = 445. Leaving the type on Prose undercounts by 222 tokens, a third of the real estimate, because the prose rule assumes a word-and-letter density that code does not have.

A 25,000-word report has 143,000 characters. Which windows does it fit, and what does sending it once cost on Claude Opus 5.5?

Prose: (143,000 / 4 + 25,000 × 1.3) / 2 = (35,750 + 32,500) / 2 = 34,125 tokens. That is 104% of 32K, so it does not fit, and 26.7% of 128K. Even 15% higher, about 39,244 tokens, it fits 128K comfortably. At $4 per million input tokens one send costs 34,125 / 1,000,000 × $4 = $0.1365.

A 1,500-token system prompt goes out with each of 200,000 calls a month on Claude Sonnet 5.5. What does it cost, allowing for the estimate’s error?

1,500 × 200,000 = 300 million tokens, times $2 per million, is $600 a month for the system prompt alone. At ±15% the real figure lies between about $510 and $690, which is close enough to decide whether trimming or caching that prompt is worth the work.

300 Chinese characters are followed by 100 characters of English in 15 words. What is the Prose estimate?

CJK characters count one each: 300. The English part: (100 / 4 + 15 × 1.3) / 2 = (25 + 19.5) / 2 = 22.25, rounded to 22. Total 322 tokens. The CJK count is not rounded or blended, so on mixed-script text it dominates the estimate and its accuracy.

401 chars 70 words ÷ 4 = 100.25 × 1.3 = 91.0 96 tokensaverage of the two code rule instead401 ÷ 3 = 134 Sonnet 5.5, $2 per 1M$0.000192 a call of an 8K window1.2% full
The sample text through the prose rule: two classic heuristics averaged into one count, which then drives both the cost and the window fit. The dashed box is what the same 401 characters give if you choose Code.

How it works

  • 1 token ≈ 4 characters of English ≈ ¾ of a word; code is denser (~3 chars).
  • CJK text counts roughly one token per character.
  • Costs use list prices per 1M input tokens as of 2026-10-28, matching the pricing comparator.
  • Everything runs locally in your browser; nothing is uploaded.

Frequently asked questions

How many tokens is a word?

For English prose, roughly 1.3 tokens per word, or about 4 characters per token, so 100 tokens is around 75 words. Common short words are usually a single token, while longer or rarer words split into several sub-word pieces. Code runs denser because symbols, brackets and unusual identifiers each cost tokens, so this tool assumes about 3 characters per token for code and 3.5 for mixed text.

How does this tool estimate tokens?

It uses rules of thumb rather than a real tokenizer. Chinese, Japanese and Korean characters count as one token each. For the rest, prose averages two classic rules, characters divided by 4 and words times 1.3; mixed text uses characters divided by 3.5; and code uses characters divided by 3. The sample paragraph, 401 characters and 70 words, comes out at 96 tokens as prose, 115 as mixed and 134 as code.

How accurate is this estimate?

Usually within about 15% for typical English text and code, but every model family uses its own tokenizer, so there is no single exact count across models anyway. The same paragraph can differ by several percent between two vendors, and unusual text such as URLs, numbers, emoji or non-English scripts can differ much more. For budgeting prompts, limits and costs an estimate is enough; for hard limits, count with the target model’s own tokenizer.

Why do token counts matter?

Almost everything about an LLM is priced and limited in tokens. API cost is charged per million input and output tokens, the context window caps how much a single request can hold, and latency grows with input length. Knowing whether a prompt is 500 or 50,000 tokens is the difference between a cheap, fast call and an expensive one, or a request the API rejects because it no longer fits the window.

Is my text uploaded anywhere?

No. The counter runs entirely in your browser: nothing you paste is sent to a server, logged or stored, because the estimate is plain arithmetic on the text’s characters and words. That makes it reasonable to paste confidential prompts or proprietary code, though your organization’s data-handling rules still apply. Clearing the box or reloading the page discards the text.