No. 01AI & LLM

Token Counter for GPT, Claude, Gemini, Llama & Qwen

Free, no signup, runs in your browser: exact token counts for GPT (o200k), Llama 3, Qwen 3 and DeepSeek V3, and estimates for Claude and Gemini. Paste a prompt or document to see its tokens, how much of each model's context window it fills, and what one call costs.

lockRuns in your browser — nothing you type is uploaded.updateLast updated money_offFree, no sign-up
Prompt or text

Exact for GPT-4o, the o-series and GPT-5. Pick Llama, Qwen or DeepSeek for exact open-weight counts.

Tokens · o200k
0
Exact for OpenAI's o200k_base encoding
Characters
0
Words
0
Lines
0
Fit & cost per call
ModelUsesCost / call
GPT-6 AstraOpenAI
<0.1%
$0.0250
GPT-6.1 SolOpenAI
<0.1%
$0.00500
GPT-6 LunaOpenAI
<0.1%
$0.00025
Claude Fable 5.1Anthropic
≈<0.1%
≈$0.0250
Claude Opus 5.5Anthropic
≈<0.1%
≈$0.0100
Claude Sonnet 5.5Anthropic
≈<0.1%
≈$0.00500
Claude Haiku 4.5Anthropic
≈0.3%
≈$0.00250
Gemini 3.1 Pro (preview)Google
≈<0.1%
≈$0.00600
Gemini 3.8 FlashGoogle
≈<0.1%
≈$0.00187
Gemini 3.5 Flash-LiteGoogle
≈<0.1%
≈$0.00125

This table uses the o200k count, which is exact for GPT. ≈ Claude and Gemini have no public browser tokenizer, so their rows apply the o200k count and are estimates. Prices are standard, uncached API rates.

See the tokens
Guide

How to use it

  1. 1
    Paste or type your text. The count updates as you type; the tokenizer loads in the background the first time.
  2. 2
    Pick a tokenizer: o200k for GPT, or Llama 3, Qwen 3 or DeepSeek V3 for an exact open-weight count. Those download once, only when selected.
  3. 3
    Set how many tokens you expect back in the answer — it counts toward both the context window and the cost.
  4. 4
    Check the table: the bar shows how much of each model's context the call uses, and the cost columns show one call and 1,000 calls.
  5. 5
    Open See the tokens to see exactly where the text is split — useful for spotting wasteful formatting.
Worked examples

Examples

A short support prompt

The built-in sample — a two-line system instruction plus a user question — is 53 tokens for 248 characters — about 4.7 characters per token. With a 500-token answer, one call on Claude Sonnet 5.5 costs about half a cent.

Formatting costs tokens

The same product data as pretty-printed JSON uses far more tokens than as a compact list, because every indent, quote and brace is counted. Paste both versions and compare — trimming formatting in a prompt you send thousands of times a day is one of the cheapest optimisations there is.

Will this document fit?

A 300-page book comes to roughly 100,000–130,000 tokens at 1.1 tokens per word. On Claude Haiku 4.5's 200K window that's up to two-thirds full before your instructions and the answer; paste a second book and its bar turns red, while the 1M-token models still show plenty of headroom.

Method

How the count and costs are produced

By default text is encoded with the byte-pair encoding o200k_base using the open-source gpt-tokenizer library. For Llama 3, Qwen 3 and DeepSeek V3 the page loads the model's public tokenizer.json from Hugging Face (Xenova/llama3-tokenizer, Qwen/Qwen3-0.6B, deepseek-ai/DeepSeek-V3) and runs it with Hugging Face's tokenizers library, without special tokens such as BOS. Everything runs in a Web Worker so long pastes don't freeze the page. Characters are counted as Unicode code points; words are runs of non-whitespace.

Context use = (text tokens + expected output tokens) ÷ the model's context window. Cost per call = text tokens × input price + output tokens × output price. Prices were checked on 2026-09-30; the LLM API cost calculator lists them all and models caching and monthly volume.

Know before you rely on it

Limitations

  • info
    The cost table always uses the o200k count. It is exact for GPT; rows marked ≈ (Claude, Gemini) are estimates, so verify with the provider's own token-counting API before relying on a tight fit.
  • info
    Chat templates, role markers and special tokens are not added, so API counts run a little higher. Models that share a family but use a different vocabulary (older Qwen, Llama 2) are not covered.
  • info
    Images, audio, PDFs and tool definitions are billed as tokens too but can't be counted from pasted text.
  • info
    The token view shows the first 400 tokens. Pieces that look empty are spaces or line breaks.

Sources: OpenAI pricing · Anthropic pricing · Gemini pricing

FAQ

Questions people ask

What is a token?

add

A token is the unit a language model reads and writes: often a whole short word, sometimes part of a longer word, a punctuation mark or a space. “Launching” might be one token, while an unusual product name can be split into three or four. Models have context limits and prices counted in tokens, not words.

Which tokenizer does this counter use?

add

You choose. By default it uses OpenAI's o200k_base encoding, the one used by GPT-4o, the o-series and GPT-5 models, via the open-source gpt-tokenizer library; that count is exact for GPT. Switch to Llama 3, Qwen 3 or DeepSeek V3 and it runs that model family's own tokenizer.json, so those counts are exact too. Claude and Gemini rows are estimates.

Can I count Llama or Qwen tokens?

add

Yes. Select Llama 3 or Qwen 3 above the count. The browser downloads that family's public tokenizer (about 9 MB for Llama 3, 11 MB for Qwen 3) the first time, then counts exactly as the model does. Llama 3.1, 3.2 and 3.3 share the Llama 3 tokenizer. Qwen 3 matches the Qwen 3 models; older Qwen versions differ slightly. The text stays on your device.

Are the counts accurate for Claude and Gemini?

add

They're close estimates, not exact. Anthropic and Google use their own tokenizers, and neither publishes one that runs in a browser, and Anthropic notes that its newer models produce roughly 30% more tokens than its older ones for the same text. For an exact figure, use Anthropic's count_tokens endpoint or Gemini's countTokens method.

How many tokens is 1,000 words?

add

For plain English prose, about 1,100 tokens with o200k_base — we measured 1.1 tokens per word on a sample essay. The often-quoted “1.3 tokens per word” comes from older tokenizers. Code, JSON, tables and non-Latin scripts use noticeably more. Paste your own text: the tokens-per-word figure shows how it compares.

Is my text sent anywhere?

add

No. The tokenizer is downloaded to your browser and runs in a background thread on your device. Only the tokenizer file is fetched; nothing you paste is uploaded or stored.

Why does my prompt use more tokens in the API than here?

add

Chat APIs wrap each message with role markers and formatting tokens, and tool definitions, images and system prompts are counted too. Expect a few extra tokens per message on top of the raw text.

From the directory

AI Coding Assistants worth a look

Launching an AI tool?

List it free on LaunchBoosts — it goes live the minute you submit and enters this week's Launch Race, where the top three win Product of the Week and a dofollow link.