Skip to content
ansezz.

▸ Free tool

Token Counter.

Paste text and get an exact GPT token count, plus Claude and Gemini estimates and the cost per call. Nothing leaves your browser.

▸ Exact for GPT

GPT counts use the real o200k_base tokenizer. Claude and Gemini counts are estimates. For billing on those, use the provider's count tokens endpoint.

▸ Token count

GPT tokens
0
Claude 4.7+ (est.)
0
Claude Haiku 4.5 (est.)
0
Gemini (est.)
0
Characters
0
Words
0

Loading exact GPT tokenizer

As input, once

  • Claude Fable 5.1 $0
  • Claude Opus 5.5 $0
  • Claude Sonnet 5.5 $0
  • Claude Haiku 4.5 $0
  • GPT-6 Astra $0
  • GPT-6.1 Sol $0
  • GPT-6 Luna $0
  • Gemini 3.1 Pro (preview) $0
  • Gemini 3.8 Flash $0
  • Gemini 3.5 Flash-Lite $0

List prices checked Oct 3, 2026

A token is not a word

Tokenizers are trained, not designed. Byte Pair Encoding starts from raw bytes and repeatedly merges the most frequent adjacent pair until it has a vocabulary of somewhere between 50,000 and 200,000 entries. What comes out is a table of subword fragments: common English words survive as a single token, rarer ones come apart into stem and suffix, and anything the training corpus barely saw falls back toward individual bytes.

Two consequences catch people out. The leading space is usually part of the token, so hello and " hello" are different entries and gluing strings together can change the count. And modern tokenizers are byte-level, so there is no unknown-token failure case. Everything encodes, some things just encode expensively.

Where four characters per token falls apart

The ~4 chars/token rule comes from English prose and holds up there. Everywhere else it leaks:

  • Code. Identifiers are not vocabulary entries: getUserById splits into several fragments, and every bracket, operator, and dot is a token of its own. Real source usually lands nearer three characters per token.
  • JSON. Braces, quotes, colons, and commas are all tokens, and every record repeats every key. A 200-row API response spends a serious share of its budget re-stating field names.
  • Whitespace. Newer OpenAI vocabularies added multi-space tokens precisely because indented Python was brutal under the GPT-2 tokenizer, where a run of indentation cost roughly one token per space. Which tokenizer you are on decides what your formatting costs.
  • High-entropy strings. UUIDs, hashes, base64 blobs, minified bundles. There are no useful merges to find, so they shatter. A single UUID can cost more than a dozen tokens.
  • Non-Latin scripts. A Chinese or Japanese character often costs a full token on its own, against roughly four English characters per token. Arabic, Hebrew, and Devanagari usually do worse, fragmenting toward individual UTF-8 bytes. Per character, that is several times the price for the same meaning.

Counts do not port between model families

There is no universal token. Every model family ships its own tokenizer, and a bigger vocabulary means fewer tokens for the same string, which is why the same paragraph can differ by a double-digit percentage across providers, and by much more if it is not English. OpenAI publishes tiktoken (cl100k_base for the GPT-4 generation, o200k_base for newer models). Anthropic does not publish Claude's tokenizer and gives you a count_tokens endpoint on the Messages API instead. Google exposes countTokens for Gemini. Open-weight models ship their tokenizer with the checkpoint, so AutoTokenizer gives you an exact count locally.

So a count measured on one model is an estimate on every other one. Migrating a prompt across providers can quietly change both your bill and whether it still fits.

Tokens are the unit of your bill and your window

Both limits that matter are denominated in tokens, and neither one is measured in characters. Pricing is per million input and output tokens, with output typically several times the price of input. The context window is a token budget shared by the system prompt, tool definitions, retrieved chunks, conversation history, the user turn, and the reply, so every token you spend on context is one the model cannot spend on an answer. Prompt caching, embedding limits, and rate limits are all measured the same way.

Which is why a text-only count is a floor, not a total. Tool and function schemas are serialised into the request and billed as input. Images are converted to tokens based on their dimensions. Neither shows up in the box above.

Exact here, estimated there

The GPT number above is the real thing. The page downloads the o200k_base merge table once, the first time you open it, and then counts every keystroke locally. That is the tokenizer GPT-4o through GPT-5.6 use. OpenAI has not published a GPT-6 tokenizer yet, so treat GPT-6 counts as very close rather than guaranteed.

Claude and Gemini are estimates. They start from the GPT count. For Claude 4.7 and later the page adds about 30%, because Anthropic says its newer tokenizer produces roughly that many more tokens than the old one. Estimates are fine for sizing: is this prompt 2k tokens or 200k, is this feature going to cost cents or hundreds. When a Claude or Gemini number becomes load bearing, ask the provider's count tokens endpoint.

  GPT count on this page Claude and Gemini on this page
What it does Runs the real o200k_base merge table Scales the GPT count by a known ratio
Where it runs In this tab, as you type In this tab, as you type
English prose Exact Usually within 10 to 20%
Code, JSON, other scripts Exact Rougher, verify with the API
Counts images and tool schemas
Use it for Billing, hard limits, chunking on GPT Sizing a prompt, sanity checks

Questions, answered

How accurate is this token counter?

The GPT count is exact. The page loads OpenAI's o200k_base tokenizer in your browser, the same merge table used from GPT-4o through GPT-5.6, and counts the raw text. Claude and Gemini tokenizers are not public in a form a web page can run, so those two numbers are estimates based on the GPT count. Anthropic says Claude 4.7 and later produce about 30% more tokens than older Claude models, so the page scales by that. Before you bet a budget on a Claude or Gemini number, check it with the provider's count tokens endpoint.

How many tokens is 1,000 words?

Roughly 1,300 to 1,400 tokens for ordinary English prose, since the working ratio is about 0.75 words per token or four characters per token. Documentation and marketing copy sit close to that. Code, JSON, and tables run well above it for the same word count, and Chinese or Arabic can multiply it several times over.

Why does my code use more tokens than the estimate?

Because source code has almost none of the properties the four-characters-per-token rule assumes. An identifier like getUserById is not a vocabulary entry, so it splits into several subword fragments, and brackets, operators, and punctuation are tokens in their own right. High-entropy strings are the worst case: UUIDs, hashes, and base64 blobs have no useful merges and shatter into something close to one token per character or two.

Do Claude and GPT count tokens the same way?

No. Each model family ships its own tokenizer with its own vocabulary and merge table, so the same paragraph produces different counts on each one. OpenAI publishes tiktoken, with cl100k_base for the GPT-4 generation and o200k_base for newer models. Anthropic does not publish Claude's tokenizer and offers a count_tokens endpoint on the Messages API instead. Google offers countTokens for Gemini. A number you measured on one model is only an estimate on any other.

Does Chinese, Japanese, or Arabic text cost more tokens?

Yes, usually several times more per character. Tokenizer vocabularies are dominated by English, so English prose compresses to about four characters per token while a Chinese or Japanese character often costs a full token on its own. Arabic, Hebrew, Thai, and Devanagari tend to fragment further, sometimes down to individual UTF-8 bytes. Larger vocabularies like o200k_base narrowed that gap but did not close it, so budget extra context and extra money for non-English workloads.

Does this token counter send my text anywhere?

No. Counting runs entirely in your browser. The only request is a one-time download of the tokenizer file from this site, and your text is never part of it. There is no server that could log what you paste. Open the network tab to check, or load the page once and then go offline.

Keep going

▸ Last verified:

Need this in production?

Shipping AI features? I build RAG pipelines, MCP servers and agents that hold up in production.

AI & MCP Integration

Keep reading