Developer / Tokens

Token Counter: Count Tokens for OpenAI Models

Count the tokens in any text exactly as OpenAI's models do, with the o200k_base tokenizer used by GPT-4o and newer and cl100k_base used by GPT-4 and GPT-3.5 Turbo, alongside characters, words, and characters per token, and see each token highlighted, all without sending your text anywhere.

Token Counter: Count Tokens for OpenAI Models: The text is encoded in your browser with js-tiktoken and OpenAI's published byte-pair vocabularies, the same ones the models use, so counts match exactly: "tiktoken is great!" is six tokens in cl100k_base. Each token is shown as a coloured piece, so you can see that common words are one token while rare words, numbers, and other scripts split into several. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Token counterLocal processing

Runs entirely in your browser

Tokens…
Characters0
Words0
Characters per token—

Counts are exact for OpenAI models that use these encodings, computed in your browser with js-tiktoken (MIT) and OpenAI's published vocabularies; your text is not sent anywhere. Other companies' models use their own tokenizers, so treat these counts as an estimate for them: in English, a token is often about four characters.

Tokens and cost

Model prices are per million input and output tokens, so token counts let you estimate a request's cost; check the provider's current price list.

Rule of thumb

In English, 100 tokens is about 75 words, or four characters a token; other languages and code usually need more tokens per word.

How to use it

  1. Paste your prompt or text.
  2. Choose the tokenizer for your model.
  3. Read the token count, and look at how the text was split.

Privacy & limitations

Your text is tokenized in your browser and never uploaded.

Related tools

Frequently asked questions

Does this count tokens for Claude, Gemini, or Llama?

Not exactly: each company uses its own tokenizer, so counts for other models can differ noticeably. Use the count here as a rough estimate for them.

Why does Chinese or Japanese use more tokens?

Vocabularies learn the most common pieces of their training text. o200k_base has more non-English pieces than cl100k_base, so the same Japanese text usually takes fewer tokens with it.

Do spaces and line breaks count?

Yes. A space is usually joined to the word after it, and line breaks are tokens too.

Free tool · runs in your browser · no account required