OpenAI Tokenizer
Paste your text and see how many tokens it uses and how the model splits it into pieces. Each colored block is one token.
Counting happens in your browser with the same vocabularies the models use, so your text is not sent anywhere.
Please note: The count is for OpenAI’s published tokenizers. Other providers count differently.
How it works
Language models do not read letters or whole words. They read tokens, which are chunks of text that often cover a word, part of a word or a bit of punctuation. Common English words are usually one token. Rare words, names, code and many non-English languages need more.
The tool offers two encodings. “o200k_base” is used by the newer GPT-4o family of models. “cl100k_base” is used by GPT-4 and GPT-3.5. Pick the one that matches the model you are calling. Other providers use their own tokenizers, so treat the result as a close guide, not an exact bill, for non-OpenAI models.
Token counts matter for cost and for limits. Prices are charged per token and every model has a maximum number of tokens it can read and write at once. A rough rule for English text is that 100 tokens is about 75 words.
Worked example: A small prompt
The text “hello world” is 2 tokens: “hello” and “ world”. Note that the space belongs to the second token. Add a few emoji or a line of code and you will see the count rise faster than the word count.
Frequently asked questions
What is a token?
A token is a chunk of text that the model treats as one unit. It can be a whole word, part of a word or punctuation.
Is my text uploaded?
No. The tokenizer runs in your browser.
Which encoding should I pick?
Use o200k_base for GPT-4o style models and cl100k_base for GPT-4 and GPT-3.5. Check the model’s documentation if you are not sure.
Does this match my API bill exactly?
It matches the text tokens. Chat messages also add a few formatting tokens, and images or tool calls are counted separately, so your bill can be slightly higher.
Why are there more tokens than words?
Most words are one token, but long, rare or non-English words are split into several pieces. Numbers and code often split a lot.
Related tools
- Word CounterPaste or type text to count words, characters, sentences and paragraphs. See reading time, speaking time and your most used words. Private, in your browser.
- JSON FormatterPaste JSON to pretty-print, minify or sort it. Get the line and column of any error. Runs in your browser, so your data is never uploaded.
- QR Code GeneratorTurn a link or text into a QR code you can download as SVG or PNG. Choose the error correction level. Free, no expiry, no sign-up.
Sources
Content last reviewed 2026-10-13.