AI Token Counter — GPT, Claude & Gemini

Count tokens exactly for GPT-4o, GPT-4, and GPT-3.5 Turbo using the real OpenAI tokenizer — plus clearly labeled estimates for Claude and Gemini, since those don't have a public client-side tokenizer. 100% in your browser.

0
Tokens
0
Characters
0
Words

What is an AI Token Counter?

Large language models don't read text character by character — they break it into tokens, sub-word chunks from a fixed vocabulary, and both API pricing and context-window limits are measured in tokens, not characters. This tool counts tokens exactly for OpenAI models by running the real tokenizer (the same byte-pair-encoding algorithm OpenAI itself uses) directly in your browser, and shows a clearly labeled estimate for Claude and Gemini, which don't expose a public client-side tokenizer.

The token breakdown view shows exactly how your text splits — useful for understanding why two prompts of similar length can cost noticeably different amounts, or why code and non-English text often tokenize less efficiently than plain English.

How to count tokens — 2 steps

  1. Pick a model. GPT-4o and GPT-4/GPT-3.5 Turbo give exact counts, since this tool runs their real tokenizer. Claude and Gemini show a labeled estimate.
  2. Paste your text. The count, character total, word total, and (for GPT models) a color-coded token breakdown update live as you type.

Real Tokenizer, Not a Guess

GPT counts use the actual byte-pair-encoding vocabulary OpenAI's models use — the same result you'd get calling their API, computed locally instead.

See The Split

The color-coded breakdown shows exactly which characters group into each token — useful for understanding cost and context-window usage, not just a number.

Nothing Leaves The Tab

Tokenization runs entirely in JavaScript in your browser. Full prompts, system messages, and API payloads are never transmitted anywhere.

Which encoding does each model use?

EncodingModelsVocabulary size
o200k_baseGPT-4o, GPT-4o mini, GPT-5 family, o1/o3/o4 reasoning models~200,000 tokens
cl100k_baseGPT-4, GPT-4 Turbo, GPT-3.5 Turbo~100,000 tokens

Anthropic (Claude) and Google (Gemini) have not published a client-side tokenizer library, so exact local counts aren't possible for those models — this tool is upfront about that rather than presenting a guess as fact.

Building with AI APIs?

Pair the token counter with the function-schema generator when wiring up tool calling.

Frequently Asked Questions

How accurate is this token counter?

For GPT-4o, GPT-5, GPT-4, and GPT-3.5 Turbo, the counts are exact — this tool runs the real byte-pair-encoding tokenizer OpenAI itself uses (the gpt-tokenizer library, a faithful JS port of tiktoken), not an approximation. For Claude and Gemini, Anthropic and Google do not publish a client-side tokenizer, so this tool shows a clearly labeled character-based estimate (~4 characters per token) instead of pretending precision it does not have.

Why do GPT-4o and GPT-4 count tokens differently?

They use different encodings. GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo all use cl100k_base. GPT-4o, GPT-4o mini, GPT-5, and the o1 reasoning models switched to o200k_base, a larger 200k-token vocabulary that tokenizes many strings (especially non-English text and code) more efficiently — fewer tokens for the same text.

Why does token count matter?

Every API call to a model like GPT-4o or Claude is billed per token, and every model has a fixed context-window limit measured in tokens, not characters or words. Knowing the real token count before you send a prompt lets you estimate cost accurately and avoid a request failing because it silently exceeded the context window.

Is a token the same as a word?

No. A token is a sub-word unit from the model's vocabulary — common short words are often one token, longer or rarer words split into two or more, and punctuation and whitespace can each be their own token. As a rough rule of thumb, 1,000 English tokens is roughly 750 words, but this varies a lot with the actual text — code, non-English text, and unusual formatting all tokenize differently than the average.

Is my text sent anywhere to count tokens?

No. Both the exact GPT tokenizer and the Claude/Gemini estimate run entirely in JavaScript in your browser. Nothing you paste here — including full prompts or system messages — is transmitted to OpenAI, Anthropic, Google, or our own servers.