Home › Learn AI › AI Tokenizer

AI Tokenizer & Token Counter

Paste text and see exactly how GPT-4o and GPT-4 split it into tokens. Colour-coded tokens, token IDs, token count, characters per token and examples in English, code, Hindi, emoji and numbers.

Try an example — notice how the token count changes:
–Tokens
–Characters
–Words
–Characters per token

How the model sees it

Each coloured block is one token. A dashed block is a single character (like a Hindi letter or emoji) that needed several tokens — hover it to see how many. Hover any token to see its ID.

Same meaning, different token counts

“Hello, how are you?” in different languages, counted with the selected encoding.

Why tokens matter

  • Cost: AI APIs charge per token — for both your prompt and the model's reply. Shorter, clearer prompts are cheaper.
  • Context window: a model can only “see” a fixed number of tokens at once (for example 128k). Long documents must fit inside that limit.
  • Languages aren't equal: Hindi, Tamil or Arabic text often uses more tokens than the same sentence in English, so it costs more and fills the context faster. Newer encodings like o200k narrow the gap.
  • Spelling and counting: because a model sees “strawberry” as a few chunks, not 10 letters, tasks like counting letters or reversing words are surprisingly hard for it.
  • Numbers: long numbers are split into groups of digits, which is one reason models can slip on arithmetic.

What is a token?

Large language models don't read letters or whole words. Text is first split into tokens — common chunks of characters learned by an algorithm called byte-pair encoding (BPE). Frequent words like “the” are one token; rare words, names and other languages are split into several pieces. Each token is then mapped to a number (its ID), and those numbers are what the model actually sees.

Which encoding should I pick?

  • o200k_base — used by GPT-4o, GPT-4.1 and OpenAI's o-series reasoning models. A 200k-token vocabulary that is much more efficient for non-English text.
  • cl100k_base — used by GPT-4 and GPT-3.5-turbo, plus OpenAI's text-embedding-3 models.

Rules of thumb (English)

  • 1 token ≈ 4 characters ≈ ¾ of a word
  • 100 tokens ≈ 75 words
  • Code, numbers and non-Latin scripts usually need more tokens per word

Claude, Gemini and Llama use their own tokenizers, so counts for those models will differ — treat this tool as an estimate for them. The tokenizer runs entirely in your browser (open-source gpt-tokenizer); your text is never uploaded.

More Learn AI