Skip to content
StackDecode

Token Counter

Count GPT tokens, characters and words, with token boundaries highlighted.

NeweasyRuns in your browser

How it works

Language models read tokens, not characters or words. These tokenizers use byte-pair encoding (BPE): start from raw bytes and repeatedly merge the most frequent adjacent pairs, learned from a large corpus. Common words become one token; rare words, code, emoji and non-English text split into several.

  • o200k_base is used by the GPT-4o family; cl100k_base by GPT-4 and GPT-3.5. They give different counts for the same text.
  • Each colour block is one token. A single character (like some emoji) can span several tokens; those are shown merged so the text stays readable.
  • Counts are exact for these OpenAI encodings only. Other models (Claude, Llama, Gemini) use their own tokenizers, so treat the number as a rough guide for them.
  • A rule of thumb for English: about 4 characters or 0.75 words per token.