Token counter

Count tokens, words and characters in text or code with the o200k_base or cl100k_base encoding. Your text stays in your browser.

Up to 60,000 characters per check.

Text counts

Tokens
0
Words
0
Characters
0

Why token counts change with the encoding

A token can be a word, part of a word or a piece of punctuation. Code, multilingual text and emoji often have a different token-to-character ratio from English prose.

Choose the encoding that matches your model. The counter measures the pasted text itself. Message wrappers, tool definitions, images and provider-specific accounting can change the total sent or billed by an API.

As a rough check, English prose averages around four characters per token, whereas dense JSON, minified code or non-Latin scripts frequently consume more tokens for the same character count.

Common questions

When should I choose o200k_base vs cl100k_base?

Use o200k_base for newer OpenAI models such as the GPT-4o and GPT-5 families, and cl100k_base for older GPT-4, GPT-3.5 Turbo and standard embedding models.

Why does the API bill slightly more tokens than the raw prompt text?

Chat APIs wrap each message with role markers and formatting tokens, and also count system prompts, tool schemas and the model’s generated response.