Token Counter
Your text never leaves your browser — tokenization runs entirely locally using the gpt-tokenizer library, loaded once from a CDN as static code.
Tokens
0
Characters
0
How to use this token counter
- Choose the encoding that matches your target model.
- Paste any text or prompt into the box above.
- The exact token count updates instantly, with token boundaries highlighted below.
What is a token?
A token is the basic unit language models process text in — often a word, part of a word, or punctuation mark, not a single character. Model context limits and API pricing are both measured in tokens, not characters, so an accurate count matters for staying within limits and estimating cost.
Why are there two different encodings?
OpenAI has used different tokenizers over time. cl100k_base powers GPT-3.5 and GPT-4, while o200k_base is the newer encoding used by GPT-4o, GPT-4o mini and the o1 models — the same text can produce a different token count depending on which one applies.
Does this work for Claude or Gemini too?
Not exactly — this counts tokens using OpenAI's tokenizers specifically. Other providers use their own tokenization, so their real counts will differ somewhat, though this is usually a reasonable ballpark estimate.