Skip to content

OpenAI tokenizer

Count tokens the way GPT models do, without sending your text anywhere.

Try a sample:
ModelTokensPrompt costContext used

Counts appear here as you type.

Choose models

Cloud models

Local models

Work out the monthly cost

GPT-5, GPT-4o and the open gpt-oss models use the o200k tokenizer. It runs here in your browser and gives the same counts as OpenAI’s own library on our reference texts.

OpenAI has not published the tokenizer of the GPT-6 family. Until it does, GPT-6 rows are counted with o200k and marked with an asterisk.

How counting works

Exact where it can be

OpenAI, DeepSeek, Qwen, Mistral, Llama and Gemma publish their tokenizers. We run them in your browser and test them against the reference implementations.

Honest where it cannot

Claude, Gemini and Grok keep their tokenizers private. You get an estimate with an error band, and the exact number on request from the vendor’s own endpoint.

Private by default

Your text is counted on your device. Nothing is uploaded unless you press the exact-count button.

Your language changes the bill

The same document needs 1.74× the tokens in Slovak, 2.00× in Hungarian and 1.27× in German compared with English on the OpenAI tokenizer.

Compare all 24 EU languages

Built for AI agents too

Agents call the same tools over MCP or a JSON API: count tokens, compare prices, check context windows.

Connect an agent

Questions

What is a token?

A token is a piece of text that a language model reads or writes: a short word, part of a longer word, a punctuation mark. Models bill and limit by tokens, not by characters or words.

Why do models give different counts for the same text?

Each model family has its own tokenizer with its own vocabulary. The same sentence can be 50 tokens on one model and 80 on another, so the lowest price per token is not always the lowest bill.

Are the counts exact?

For models with a public tokenizer, yes: it is the count the model sees for plain text. Chat formatting adds a few tokens per message. For Claude, Gemini and Grok the count is an estimate unless you ask for the exact number.

Is my text stored?

No. Counting runs in your browser. If you ask for an exact vendor count, the text passes through our server to the vendor and is not kept or logged.