Skip to content
Devtoolry

Token Counter

Count GPT tokens exactly with the OpenAI tokenizers (o200k for GPT-5 and GPT-4o, cl100k for GPT-4) and see how your prompt is split. Runs in your browser.

Runs in your browser · Nothing uploaded · No sign-up

Something not working, or missing a feature? Send feedback

About the Token Counter

The Token Counter counts exactly how many tokens a prompt or document uses with OpenAI's own tokenizers: o200k_base for GPT-5, GPT-4.1, GPT-4o and the o-series, and cl100k_base for GPT-4 and GPT-3.5. It shows how the text is split into tokens and their IDs, so you can stay within context limits and estimate API costs. The text is tokenized in your browser and never sent anywhere.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the Token Counter

  1. Paste your prompt, system message, document or code.
  2. Choose the tokenizer of your model: o200k for GPT-5 and GPT-4o, cl100k for GPT-4 and GPT-3.5.
  3. Read the token, character and word counts.
  4. Look at the coloured tokens to see where the text splits, or switch to token IDs and copy them.

Which tokenizer each model uses

TokenizerVocabularyModels
o200k_base~200,000 tokensGPT-5 family, GPT-4.1, GPT-4o, GPT-4o mini, o1, o3, o4-mini
cl100k_base~100,000 tokensGPT-4, GPT-4 Turbo, GPT-3.5 Turbo, text-embedding-3, text-embedding-ada-002

Sources: OpenAI tiktoken

Examples

A short sentence

Input

Hello, world!

Result

4 tokens: "Hello" "," " world" "!"
Code

Input

const total = items.reduce((sum, x) => sum + x.price, 0);

Result

19 tokens with both tokenizers
Hindi text

Input

नमस्ते दुनिया

Result

o200k: 5 tokens · cl100k: 13 tokens

Common mistakes

  • Counting characters instead of tokens. Context limits and prices are per token. A JSON payload or minified code can use far more tokens than its length suggests.
  • Using the wrong tokenizer. GPT-4 and GPT-4o split text differently. Counts from cl100k are usually higher for non-English text, so choose the tokenizer of the model you call.

Works well with the Token Counter

Frequently asked questions

How many tokens is a word?

For English text, a token is about 4 characters or three quarters of a word, so 100 words are roughly 130 tokens. Code, numbers and other languages use more tokens per word.

Why do Hindi and other languages use more tokens?

Tokenizers learn common character sequences from their training data. The newer o200k tokenizer has many more non-English pieces: "नमस्ते दुनिया" is 5 tokens with o200k but 13 with cl100k.

Does this count tokens for Claude or Gemini?

No. Claude, Gemini and Llama use their own tokenizers, so the same text gives them a different count. Use the count as a rough guide for them; for an exact Claude count, use the token counting endpoint of Anthropic's API.

Are chat messages counted the same way?

Chat APIs add a few tokens per message for the role and separators, so a conversation uses slightly more than its texts alone. Images and tool definitions are counted separately.

Is my text uploaded?

No. The tokenizer (the open-source gpt-tokenizer library) runs in your browser, so prompts with private data stay on your device.