Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

LLM Token Counter

Count tokens exactly for OpenAI models, estimate them for Claude, Gemini, and Llama, see every token, and check context-window fit and API cost.

Processed locally in your browser — nothing is uploaded.

LLM Token Counter

0 characters

Counts

Tokens (o200k_base)
0
Tokens (cl100k_base)
0
Characters
0
Words
0

Exact counts from OpenAI's published tokenizers. Chat requests add a few tokens per message for formatting.

Tokens

Tokens appear here, each in its own colour…

Hover a token for its id. Where one character is split across several tokens — common with emoji and some scripts — those tokens are shown as a single block.

Models

ModelTokensContext window usedInput cost
GPT-5.5OpenAI0exact0% of 1,050,000$0.00
GPT-5.4 miniOpenAI0exact0% of 400,000$0.00
GPT-5OpenAI0exact0% of 400,000$0.00
GPT-4.1OpenAI0exact0% of 1,047,576$0.00
GPT-4oOpenAI0exact0% of 128,000$0.00
GPT-4o miniOpenAI0exact0% of 128,000$0.00
GPT-4 TurboOpenAI0exact0% of 128,000—
Claude Fable 5.1Anthropic≈ 0estimate0% of 1,000,000$0.00
Claude Opus 5.5Anthropic≈ 0estimate0% of 1,000,000$0.00
Claude Sonnet 5.5Anthropic≈ 0estimate0% of 1,000,000$0.00
Claude Haiku 5.5Anthropic≈ 0estimate0% of 1,000,000$0.00
Gemini 3.1 Pro (preview)Google≈ 0estimate0% of 1,048,576$0.00
Gemini 3.8 FlashGoogle≈ 0estimate0% of 1,048,576$0.00
Gemini 2.5 FlashGoogle≈ 0estimate0% of 1,048,576$0.00
Llama 3.3 70BMeta≈ 0estimate0% of 128,000—

Exact counts use OpenAI's own open-source tokenizers. Estimates are for models whose tokenizers aren't bundled here:

  • Claude: Anthropic hasn't published Claude's tokenizer. Estimated as 1.15–1.6× the cl100k_base count: OpenAI's tokenizers undercount Claude by roughly 15–20% on English prose, and Claude's current tokenizer uses up to about 35% more tokens than older Claude models. Code and non-English text can run higher. Anthropic's count_tokens API gives the exact number.
  • Gemini: Google hasn't published Gemini's tokenizer. Estimated from Google's rule of thumb of about 4 characters per token (100 tokens ≈ 60–80 English words). Non-English text, especially Chinese, Japanese, and Korean, can take far more. The Gemini API's countTokens method gives the exact number.
  • Llama: Llama 3's tokenizer is open but not bundled here. Its vocabulary extends cl100k_base and splits text the same way, so the cl100k_base count is a close estimate for English; other languages often take fewer tokens.

Input cost is for this text at each provider's standard list price as of October 12, 2026, without batch or cached-input discounts.

Cost estimate

Roughly how long you expect each reply to be.

Each request sends this text once.

Estimated cost

Input tokens per request
0
Input cost
$0.00
Output cost
$0.015
Total
$0.015

List prices as of October 12, 2026; leave the price fields empty to use them, or type the rates you actually pay.

About LLM Token Counter

Paste a prompt, a document, or a chat message to see how many tokens it uses, how much of each model's context window that fills, and what sending it would cost. Language models read and bill text in tokens — chunks that are often a whole short word, a piece of a longer one, or a single punctuation mark — so a character or word count only approximates what you'll actually pay for.

Exact where it can be, estimated where it can't — and labelled either way. OpenAI publishes its tokenizers, so counts for GPT-5.5, GPT-5, GPT-4.1, and GPT-4o (the o200k_base encoding) and for GPT-4 and GPT-3.5 (cl100k_base) are exact, computed with the same byte-pair encoding the API uses. Anthropic and Google don't publish the tokenizers behind Claude and Gemini, so those rows are marked as estimates and show a range rather than a single number pretending to be precise:

  • Claude is estimated at 1.15–1.6× the cl100k_base count. OpenAI's tokenizers typically undercount Claude by roughly 15–20% on English prose, and Anthropic says the tokenizer in its current models uses up to about 35% more tokens than older Claude models did.
  • Gemini is estimated from Google's own rule of thumb: about 4 characters per token, or 60–80 English words per 100 tokens.
  • Llama 3 has an open tokenizer that isn't bundled here, but its vocabulary extends cl100k_base and splits text the same way, so that count is a close stand-in for English.

For an exact Claude or Gemini number before a large job, both APIs offer a free token-counting endpoint.

See the tokens. The text is redrawn with every token in its own colour, so you can see that " world" is one token including its leading space, that a rare word breaks into several pieces, or that an emoji can take three or four. Switch between o200k_base and cl100k_base, show token ids instead of text, or mark spaces and line breaks in Options.

Cost and fit. Each model's row shows the share of its context window your text fills and the input cost at its list price. The cost estimate below takes an expected reply length and a number of requests and totals input and output cost; prices come from a small table dated 12 October 2026, and you can type your own rates for discounted, batch, or self-hosted pricing.

The tokenizer data is several megabytes, so it loads only once you start typing — and it runs entirely in your browser. Prompts with confidential data never leave the page.

Common uses

  • Check whether a long document or codebase excerpt fits in a model's context window
  • Estimate what a batch job or a production prompt will cost per request and per thousand
  • Trim a system prompt and see exactly how many tokens each change saves
  • Understand why non-English text, code, or emoji cost more tokens than you expect

Example

Input

hello world

Output

o200k_base: 2 tokens — “hello” (24912) and “ world” (2375)

The space belongs to the second token. Most English words are a single token when they follow a space, which is why a token averages about four characters of English.

Limitations

  • Claude and Gemini counts are estimates; expect real counts within the range shown for English prose, and possibly above it for code or other languages
  • Chat-formatted requests add a few tokens per message, and images, tools, and system instructions are counted separately by each API
  • Prices change; the table shows standard list prices on 12 October 2026 without batch or cached-input discounts

Frequently asked questions

How many tokens is 1,000 words?

For ordinary English with OpenAI's current tokenizer, roughly 1,300 tokens — about 0.75 words per token, or 4 characters per token. Technical writing, code, unusual names, and non-English languages take more. Paste your actual text for an exact OpenAI count rather than relying on the ratio.

Why do GPT-4o and GPT-4 give different token counts for the same text?

They use different encodings. GPT-4o, GPT-4.1, and the GPT-5 family use o200k_base, a vocabulary of about 200,000 tokens; GPT-4 and GPT-3.5 Turbo use cl100k_base with about 100,000. The larger vocabulary covers more words and non-English text in single tokens, so o200k_base usually produces slightly fewer tokens.

Are the Claude and Gemini token counts exact?

No, and the table says so. Anthropic and Google haven't published the tokenizers for Claude and Gemini, so those counts are estimates with a range: Claude is scaled from the cl100k_base count and Gemini follows Google's guidance of about 4 characters per token. For an exact figure, use Anthropic's count_tokens endpoint or the Gemini API's countTokens method.

How do I know if my prompt fits in the context window?

Each model's row shows how much of its context window your text fills, with a bar that turns red past 100%. Remember the window covers input and output together, so leave room for the reply you expect — and for system prompts, tool definitions, and earlier conversation turns if you send them.

How is the API cost calculated?

Input tokens times the input price plus expected output tokens times the output price, with prices quoted per million tokens and multiplied by the number of requests. The built-in prices are each provider's standard list prices as of 12 October 2026. Cached input, batch discounts, long-context surcharges you negotiate, or self-hosting change the real figure, so you can type your own rates.

What is a token?

A token is the unit a language model reads and writes: a frequent word with its leading space, a fragment of a rarer word, a punctuation mark, or a few bytes of an emoji. Tokenizers are built with byte-pair encoding, which learns which character sequences are common enough to deserve a single token.

Is my text sent to OpenAI or anyone else to be counted?

No. The tokenizer is downloaded once and runs in your browser; the text you paste is never uploaded, logged, or sent to any model provider.