induwara.lk
induwara.lkAI · Developer Tool

AI Token Counter — GPT-5, Claude 4.x, Gemini 3 & Llama 4

Paste any prompt or document and see exactly how many tokens it uses across 10popular models — and what fraction of each model's context window that takes up. Runs entirely in your browser, no API key required.

By Induwara AshinsanaUpdated May 12, 2026
Count tokensacross 10 models

Runs entirely in your browser. Nothing is uploaded, logged, or stored.

Try a sample
Characters
0
Words
0
Lines
0
Code points
0
Same as characters

Tokens by model

OpenAI
GPT-5
0tokens
Context window0%
Limit400,000
OpenAI
GPT-4o
0tokens
Context window0%
Limit128,000
OpenAI
GPT-4 Turbo
0tokens
Context window0%
Limit128,000
Anthropic
Claude Opus 4.7 (1M)
0tokens
Context window0%
Limit1,000,000
Anthropic
Claude Sonnet 4.6
0tokens
Context window0%
Limit200,000
Anthropic
Claude Haiku 4.5
0tokens
Context window0%
Limit200,000
Google
Gemini 3 Pro
0tokens
Context window0%
Limit2,000,000
Google
Gemini 3 Flash
0tokens
Context window0%
Limit1,000,000
Meta
Llama 4 Scout
0tokens
Context window0%
Limit10,000,000
Meta
Llama 4 Maverick
0tokens
Context window0%
Limit1,000,000

Methodology: regex BPE pre-tokenizer (adapted from tiktoken cl100k_base) with per-vendor multipliers calibrated against the official tokenizers. Context windows verified against vendor model cards on the dates linked under “Sources”.

How it works

Large language models don't read text the way humans do. They read it as a sequence of tokens — short integer IDs each standing for a word, a sub-word fragment, or a piece of punctuation. Every API charges per token in and per token out, and every model has a hard ceiling on the total tokens it can hold in one request (its context window). Knowing your token count before you send is the difference between a clean response and a 400 error.

Each vendor trains its own tokenizer on its own data, so the same paragraph yields different counts on different models. OpenAI's GPT-3.5 and GPT-4 use cl100k_base (100 277 tokens); GPT-4o and GPT-5 use the newer o200k_base(200 000 tokens) which is slightly more efficient on prose. Anthropic's Claude uses a distinct BPE vocabulary that produces roughly 10–15 % more tokens than tiktoken on the same English text. Google's Gemini uses SentencePiece with efficiency similar to tiktoken. Meta's Llama 3 and Llama 4 use a 128 000-token vocabulary close in style to cl100k_base.

The exact merge tables for each vocabulary are 1.7–5 MB each. Shipping them in the browser would push initial page weight past our 400 KB performance budget. Instead this calculator runs a regex-based pre-tokenizer derived from tiktoken's cl100k_base PAT pattern — splitting text into words, numbers, punctuation, and whitespace runs the same way BPE does — and then assigns a token count to each piece by length, applying a per-vendor multiplier calibrated against published benchmarks. A second method (chars-per-token ratio) runs in parallel as a cross-check; if the two disagree by more than 25 %, the per-model card flags low confidence so you know the text is probably code, emoji, or non-Latin script and the count is rougher than usual.

On English prose the estimate is within ±5 % of every vendor's official tokenizer. That accuracy is more than enough for “will this fit?” and “roughly how much will this cost?” questions. If you're running a paid pipeline at scale and need counts to the exact token, send through the official tokenizer server-side at request time — that's also what every vendor recommends.

Worked examples

Short prompt

"Hello, world!" (13 characters, 2 words)

  1. Pre-tokenizer pieces: "Hello"(5) + ","(1) + " world"(6) + "!"(1)
  2. All four pieces ≤ 7 chars → 1 token each → 4 tokens (cl100k baseline)
  3. GPT-4o (o200k, multiplier 0.96): round(4 × 0.96) = 4 tokens
  4. Claude (multiplier 1.15): round(4 × 1.15) = 5 tokens
  5. Real cl100k tokenizer: 4 tokens — exact match.

Long uncommon word

"supercalifragilisticexpialidocious" (34 characters, 1 word)

  1. Pre-tokenizer pieces: 1 piece of 34 chars
  2. Length > 12 → ceil(34 / 4) = 9 sub-tokens (cl100k baseline)
  3. Claude (1.15×): round(9 × 1.15) = 10 tokens
  4. Llama 4 (1.05×): round(9 × 1.05) = 9 tokens
  5. Real cl100k tokenizer: 9 tokens — exact match.

Empty input — edge case

Nothing pasted yet

  1. Pre-tokenizer pieces: []
  2. Total: 0 tokens for every model
  3. Context-window utilisation: 0 %
  4. All cards render at zero — no NaN, no error.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a model with a stale context window, or want a vendor added?

Email me at [email protected] — most updates ship within 24 hours.