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-4o, Gemini, Llama), 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-4o)0.1%
200K (Claude)0%
1M (Gemini)0%
Cost to send once, as input
Model$ / 1M inputThis text
Claude Opus 4$15.00$0.001440
Claude Sonnet 4$3.00$0.000288
Claude Haiku 3.5$0.8000$0.000077
GPT-4o$2.50$0.000240
GPT-4o mini$0.1500$0.000014
Gemini 2.5 Pro$1.25$0.000120
Gemini 2.5 Flash$0.3000$0.000029
Llama 3.1 70B$0.6000$0.000058

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 the tool’s illustrative list prices per million input tokens for eight models, the same table as the pricing comparator. 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 Opus 4$15.00$0.001440
Claude Sonnet 4$3.00$0.000288
GPT-4o$2.50$0.000240
Gemini 2.5 Pro$1.25$0.000120
GPT-4o mini$0.1500$0.000014

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 $1,440 on Opus and about $14 on GPT-4o mini, 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.

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 illustrative list prices per 1M input tokens, 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.