LLM Token Counter

Count GPT tokens with the o200k_base and cl100k_base tokenizers.

Tokens
0
Characters
0
Words
0

Counts are exact for OpenAI models that use these encodings. Claude, Gemini, Llama and other models use their own tokenizers, so treat the count as an approximation for them.

How to use the LLM token counter

  1. Choose an Encoding: o200k_base for GPT-4o, GPT-4.1 and the o-series reasoning models, or cl100k_base for GPT-4 and GPT-3.5 Turbo.
  2. Type or paste your prompt. The token, character and word counts update as you type.
  3. Tick Show tokens to see how the text is split; neighbouring tokens get alternating backgrounds.
  4. Use Copy token ids to copy the token ids as a JSON array.

Example

With o200k_base, hello world is 2 tokens, hello and world(the space belongs to the second token), with ids [24912, 2375]. The sentenceThe quick brown fox jumps over the lazy dog. is 10 tokens in both encodings. Text in other scripts costs more: 日本語のテキスト is 6 tokens with o200k_base and 8 withcl100k_base, because the newer vocabulary has more entries for non-English text.

Frequently asked questions

Why count tokens at all?

Language models measure context windows, output limits and pricing in tokens, not characters. Counting before you send a prompt tells you whether it fits and roughly what it will cost. For English, one token is about four characters or three quarters of a word.

Are the counts right for Claude or Gemini?

Only roughly. This page runs OpenAI's open tiktoken encodings. Anthropic, Google, Meta and others train their own tokenizers, which can split the same text into a different number of tokens, so use the number as an estimate and check the provider's own token counting API when you need the exact figure.

Is my text uploaded?

No. The tokenizer is downloaded once as part of this page and runs in your browser; your text never leaves your device.