LLM Token Counter

What do you want to do?

Up to 2,000,000 UTF-16 code units (about 2 MB). Nothing is saved when you leave this page.

OpenAI encoding

Counted on your device: the text is not uploaded, saved or put into links. Budget a whole agent workflow

Paste text to count its tokens

Counted on your device: the text is not uploaded, saved or put into links.

About this tool

Paste a prompt, a document or a chunk of code and the counter shows how many tokens it is. OpenAI's o200k_base and cl100k_base encodings are counted exactly, with the same tokenizer the models use, running in your browser. Claude and Gemini are estimated from the ratios Anthropic and Google publish, and every estimate is marked with ≈.

No text yet? Switch to Words ↔ tokens to answer questions such as "how many tokens is 1,000 words?" or "how many words fit in 200,000 tokens?". Both modes show what share of each model's context window the count fills, from Claude Haiku 4.5's 200K to Llama 4 Scout's 10 million tokens.

How it works

Count text: paste or type into the box. The GPT count appears after a moment the first time, while the tokenizer loads; later counts are almost instant, and very long texts are counted in the background so the page stays responsive. Pick cl100k_base for GPT-4, GPT-3.5 and the text-embedding-3 models; o200k_base covers GPT-4o, GPT-4.1, the GPT-5 family and the o-series.

Words ↔ tokens: choose whether your number is words or tokens and type it. Each model family gets its own figure, because tokenizers differ: Claude models from Opus 4.7 on use a newer tokenizer that produces more tokens for the same text.

To turn the counts into money, use the AI agent cost calculator: it takes your model's input and output prices, caching and retries.

Example

"Hello world" is 2 tokens in o200k_base. It has 11 characters, so the Claude estimate is 11 ÷ 2.5 = 4.4, shown as ≈ 4; for Claude models before Opus 4.7 it is 4.4 ÷ 1.3 ≈ 3, and for Gemini 11 ÷ 4 ≈ 3.

A 150,000-word manuscript is about 270,270 tokens on the current Claude tokenizer (150,000 ÷ 0.555), 27.0% of a 1M window. On the earlier Claude tokenizer it is about 200,000 tokens (150,000 ÷ 0.75), which fills Claude Haiku 4.5's 200K window exactly.

Assumptions and limits

Only the OpenAI counts are exact, and only for models that use the selected encoding. GPT-6's encoding is not published, so its row uses the o200k_base count as an approximation. Claude and Gemini counts are estimates from vendor ratios stated for English text; code, numbers and other languages can differ a lot. Even Anthropic's own counting endpoint returns an estimate. Meta publishes no ratio for Llama, so Llama rows reuse the GPT count.

The counts cover the text only. A chat request adds a few tokens per message for roles and formatting, plus the system prompt, tool definitions and any images. Text is limited to 2,000,000 UTF-16 code units.

Frequently asked questions

Why is the GPT count exact but Claude only estimated?

OpenAI publishes its tokenizers, so the same encoding can run in your browser and give the number the API will count. Anthropic and Google do not publish downloadable tokenizers for their current models. Anthropic offers a free counting endpoint, but it needs an API key and its docs call the result an estimate, so a public page can only apply the published ratios.

Do Claude Opus 4.7 and newer models really use more tokens?

Yes. Anthropic's token counting docs say Claude 4.7 and later models use a newer tokenizer and that the same text produces approximately 30 percent more tokens than on earlier models, with the exact increase depending on the content. That is why the counter shows two Claude rows. Recount prompts rather than reusing counts measured on an older model.

How many tokens is 1,000 words?

About 1,333 tokens for GPT (OpenAI's rule of thumb is 100 tokens ≈ 75 words), about 1,802 for Claude Opus 4.7 and newer (1M tokens ≈ 555,000 words), about 1,333 for earlier Claude models and about 1,429 for Gemini (100 tokens ≈ 60–80 words). English prose is assumed; other languages usually need more tokens per word.

Is my text uploaded or saved?

No. Counting runs on your device, and the text is never sent to a server, stored in the browser or put into a link. Copy link shares only the settings, such as the encoding or a number of words or tokens. Reloading the page clears the text.

What is a context window?

It is the maximum number of tokens a model can take in one request, including your input and, for most models, the output it writes. If a document plus your instructions and the expected answer exceed it, the request fails or the text must be split. The fit view uses each vendor's published window, checked on the date shown.

How the estimates are calculated

C is the number of characters, W the number of words, T the tokens and r the words per token that each vendor publishes for English.

TClaude≈C2.5,TClaude<4.7≈TClaude1.3,TGemini≈C4T_{\text{Claude}} \approx \frac{C}{2.5},\quad T_{\text{Claude}<4.7} \approx \frac{T_{\text{Claude}}}{1.3},\quad T_{\text{Gemini}} \approx \frac{C}{4}
T≈Wr,r=0.75 (GPT), 0.555 (Claude), 0.75 (Claude<4.7), 0.7 (Gemini)T \approx \frac{W}{r},\quad r = 0.75\ (\text{GPT}),\ 0.555\ (\text{Claude}),\ 0.75\ (\text{Claude}<4.7),\ 0.7\ (\text{Gemini})

Sources and dates

Every ratio and context window below was checked at its source on October 24, 2026.

  • OpenAI: 1 token ≈ 4 characters ≈ ¾ of a word; 100 tokens ≈ 75 words. GPT (OpenAI)
  • Anthropic: 1M tokens ≈ 555,000 words or 2.5M Unicode characters on the tokenizer introduced with Claude Opus 4.7. Claude, Opus 4.7 and newer
  • Anthropic: earlier models fit about 750,000 words in 1M tokens; the newer tokenizer produces approximately 30% more tokens for the same text. Claude before Opus 4.7
  • Google: a token is about 4 characters; 100 tokens ≈ 60–80 English words. Gemini
  • Exact counts: the open-source gpt-tokenizer library, and OpenAI's model-to-encoding mapping in tiktoken. gpt-tokenizer, tiktoken model.py
  • Meta lists Llama 4 context lengths but no characters or words per token. Llama 4
Context windows used in the fit view
ModelContext window (tokens)Count used
GPT-5.51,050,000GPT (OpenAI)
GPT-6 Astra, Sol, Luna1,050,000maximum input 922,000GPT (OpenAI) (approximate)
Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.51,000,000Claude, Opus 4.7 and newer
Claude Haiku 4.5200,000Claude before Opus 4.7
Gemini 3.8 Flash1,048,576Gemini
Llama 4 Maverick1,000,000GPT (OpenAI) (approximate)
Llama 4 Scout10,000,000GPT (OpenAI) (approximate)
Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
modeWhat do you want to do?one of: text, wordsdefault text
textText to countnot accepted in links: enter it on the page
encodingOpenAI encodingone of: o200k_base, cl100k_base; used with mode = textdefault o200k_base
wordsWordswhole number; allowed 1–100000000; used with mode = wordsrequired
tokensTokenswhole number; allowed 1–100000000; used with mode = wordsrequired

Examples

  • ?encoding=cl100k_base
  • ?words=1000
  • ?mode=words&tokens=200000

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="token-count"]