Count Words

Token Counter

Count tokens with OpenAI's tokenizer encodings. Paste text, pick an encoding and see the token count next to words and characters, plus how the text splits into tokens. Counting runs in your browser.

Your text

Encoding

Models that use this encoding in tiktoken's model list include gpt-5, gpt-4.5-preview, gpt-4.1, gpt-4o, o1, o3, o4-mini.

Tokens in your text

Type or paste text above to see how it splits into tokens.

Each shaded block is one token. Hover a block to see its token ID. A block can hold more than one ID when a single character, such as some emoji or CJK characters, is split across several tokens.

Token count

Tokens

0

Counted with o200k_base

Words

0

Characters

0

Tokens per word

0.00

Characters per token

0.00

Words per token

0.00

How this counts

Tokens are counted with js-tiktoken, a JavaScript port of OpenAI's open-source tiktoken library, using the encoding you pick. This is the count for the text itself. An API request can report a few more tokens, because chat messages carry formatting, and images, files and tool definitions are counted separately. Characters are Unicode characters, so an emoji counts as one.

Claude and Gemini

Anthropic's Claude and Google's Gemini use their own tokenizers, so the numbers here apply to OpenAI encodings only. Both providers document how to count tokens for their models; Google's own rule of thumb for Gemini is about 4 characters per token, or 60 to 80 English words per 100 tokens. Anthropic gives no such ratio, and calls its token count an estimate.

Which encoding to use

o200k_base

The encoding tiktoken maps to GPT-4o, GPT-4.1, GPT-4.5, GPT-5 and the o1, o3 and o4-mini reasoning models. Use it for current OpenAI chat models.

cl100k_base

The encoding tiktoken maps to GPT-4, GPT-3.5 Turbo and the text-embedding-3 and ada-002 embedding models. Use it for those older chat models and for embeddings.

Other providers

Claude, Gemini, Llama and other model families each have their own tokenizer. The same text gives a different count in each, so use the provider's own counter for those.

Fit a context window

Check that a long prompt, document or transcript fits a model's context window before you send it, with room left for the reply.

Estimate API cost

Multiply the token count by the price per token on the provider's pricing page to estimate what a request will cost as input.

Compare text and encodings

See how numbers, links, code and other languages change the tokens per word, and how the older cl100k_base encoding compares with o200k_base on the same text.

Sources

Limits last checked against these sources on 2026-10-19.

More tools

Related tools

Count words and characters, check how readable a draft is, or turn a word count into pages.

Token counter FAQ

What is a token?

A token is a unit of text a language model reads: often a whole common word with its leading space, sometimes part of a longer word, a punctuation mark or a piece of an emoji. OpenAI's rule of thumb is about four characters, or three quarters of a word, of English text per token.

Which encoding should I choose?

Choose o200k_base for GPT-4o and newer OpenAI models, including GPT-4.1, GPT-5 and the o-series. Choose cl100k_base for GPT-4, GPT-3.5 Turbo and OpenAI's embedding models. The mapping comes from the model list in OpenAI's tiktoken library.

Is the count exact?

For the text itself, it matches tiktoken, because it uses the same encoding files. The usage an API reports for a request can be a little higher, since chat messages add formatting tokens, and images, files and tool definitions are counted separately.

Does this work for Claude or Gemini?

No. Claude and Gemini use their own tokenizers, so an OpenAI count is not a reliable stand-in for them. Anthropic and Google both offer a way to count tokens for their models; the links are in the results panel.

Why does some text use more tokens per word?

Tokenizers are built so that common English words are a single token. Rare words, numbers, dates, links, code and many non-English languages are split into more pieces, so the same number of words can cost noticeably more tokens.

Is my text sent anywhere?

No. The encoding file is downloaded to your browser the first time you count, and the counting happens on your device. Your text is not uploaded.