Free tool

Token counter and tokenizer for GPT, Claude and Gemini

Paste any text to get its exact token count for OpenAI's tokenizers (o200k_base, cl100k_base and gpt-oss's o200k_harmony), labelled estimates for Claude and Gemini, a view of every token, and the API cost and context-window share. Free, no sign-up, and it runs in your browser.

Paste a prompt, a document or code. Counts update as you type.

Loading the OpenAI tokenizer data (about 1.5 MB, downloaded once)...

Tokens with o200k_base

...

GPT-5 family, GPT-4.1, GPT-4o and the o-series.

Characters
-
Words
-
Tokens per word
-
Characters per token
-
Token counts by tokenizer
TokenizerTokens
o200k_base Exact
GPT-5 family, GPT-4.1, GPT-4o, o1, o3, o4-mini
Loading
cl100k_base Exact
GPT-4, GPT-3.5 Turbo, text-embedding-3
Loading
o200k_harmony Exact
gpt-oss-20b, gpt-oss-120b
Loading
Claude Opus 4.7 and later Estimate
Every Claude 5 model, Opus 4.7, Opus 4.8
-
Claude, earlier models Estimate
Sonnet 4.6, Opus 4.6, Haiku 4.5 and older
-
Gemini Estimate
Gemini API models
-

Claude and Gemini figures are estimates from each vendor's published rule of thumb, not their tokenizers.

How the Claude and Gemini estimates work

See how the text splits into tokens

Tokenizer
Show

Loading the tokenizer...

Estimate the cost and check the context window

Standard-tier list prices from each vendor's pricing page, checked 17 October 2026. Edit any field to use your own.

Output includes reasoning tokens. Counts accept 128k or 1m.

Cost per request

-

Cost breakdown
PartPer requestFor 1,000
Input--
Output--
Total--

Context window

Enter a context window size in tokens.

Runs entirely in your browser. Nothing you type is sent to Olano or anyone else; the tokenizer files download from olano.ai and are cached by your browser.

What is a token?

A token is the unit a language model reads, writes and bills: a word, part of a word, a punctuation mark, a run of spaces or a few bytes of a character. Prices, rate limits and context windows are all set in tokens, not words.

Tokenizers build their vocabulary with byte-pair encoding: frequent sequences such as " the" become one token, rare ones are spelled out from smaller pieces. OpenAI's o200k_base has 200,019 token IDs, the older cl100k_base 100,277, and a bigger vocabulary usually means fewer tokens, above all outside English.

How many tokens is a word?

In English, about 1.15 tokens per word for plain prose with OpenAI's o200k_base, and more when the text carries numbers, JSON or code. Other languages need more tokens for the same meaning.

Measured with this tool on 17 October 2026, the English Universal Declaration of Human Rights, 1,753 words, is 2,017 o200k_base tokens (1.15 per word); the tool's opening prompt, with a line of JSON, is 98 tokens for 67 words (1.46); the Python example is 84 for 40 (2.10). Translations say the same thing, so they compare languages fairly. Words come from the browser's word segmenter, which splits Chinese and Thai into dictionary words.

Tokens by language, full UDHR text
LanguageWordso200k_base tokensTokens per wordvs Englishcl100k_base tokens
English1,7532,0171.151.00×2,016
Spanish1,9132,4531.281.22×2,963
Malay1,6823,0981.841.54×3,875
Vietnamese2,4786,8862.783.41×8,586
Russian1,5972,7851.741.38×5,104
Hindi1,9613,1781.621.58×10,607
Tamil1,2044,5833.812.27×18,293
Chinese (Simplified)1,5332,2521.471.12×3,291
Thai2,3313,9241.681.95×8,921

Vietnamese needs 3.4 times the tokens of English, and cl100k_base is far worse outside Latin script: Tamil takes four times as many tokens there as on o200k_base. Vendors publish rules of thumb too: Google says 100 Gemini tokens are about 60 to 80 English words, and Anthropic says 1M tokens on Claude's current tokenizer is roughly 555,000 words.

Why do token counts differ between models?

Each model family has its own tokenizer, so the same text counts differently on each.

Tokenizers and the models that use them
TokenizerToken IDsUsed byOn this page
o200k_base200,019GPT-5 family, GPT-4.5, GPT-4.1, GPT-4o, o1, o3, o4-miniExact
cl100k_base100,277GPT-4, GPT-3.5 Turbo, text-embedding-ada-002, text-embedding-3Exact
o200k_harmony201,088gpt-oss-20b, gpt-oss-120bExact
GPT-6 familyNot publishedGPT-6 Astra, GPT-6.1 Sol, GPT-6 Lunao200k_base as a stand-in
ClaudeNot publishedAll Claude modelsEstimate
GeminiNot publishedGemini modelsEstimate

The OpenAI rows come from tiktoken's model map, which stops at GPT-5; OpenAI has not said which encoding GPT-6 uses. o200k_harmony adds the special tokens of gpt-oss's harmony format to o200k_base, so only markers such as <|start|> split differently. Claude changed tokenizer with Opus 4.7, which Anthropic says produces about 30% more tokens for the same text. API counts also include formatting tokens for message roles, as OpenAI's guide notes.

Can you count Claude and Gemini tokens offline?

Not in a browser today. Anthropic publishes no tokenizer for current models (its old TypeScript tokenizer says it stopped being accurate with Claude 3), and Google's Gen AI SDK counts locally only after downloading tokenizer data this page does not ship.

So the tool shows a range from the vendors' published equivalences: Claude's current tokenizer, characters ÷ 2.5 and words ÷ 0.555; earlier Claude models, words ÷ 0.75; Gemini, characters ÷ 4 and words ÷ 0.6 to 0.8. The cost panel uses the upper end. These are English rules of thumb, so there is no estimate when most letters are in another script.

How do you count tokens in code?

Use tiktoken locally for OpenAI encodings, and each vendor's counting endpoint for a whole request.

import tiktoken

enc = tiktoken.get_encoding("o200k_base")  # or tiktoken.encoding_for_model("gpt-4o")
print(len(enc.encode("tiktoken is great!")))  # 6
from openai import OpenAI

client = OpenAI()
response = client.responses.input_tokens.count(
    model="gpt-6-astra",
    input="Tell me a joke.",
)
print(response.input_tokens)
import anthropic

client = anthropic.Anthropic()
response = client.messages.count_tokens(
    model="claude-opus-5-5",
    messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(response.input_tokens)
from google import genai

client = genai.Client()
response = client.models.count_tokens(
    model="gemini-3.8-flash",
    contents="The quick brown fox jumps over the lazy dog.",
)
print(response.total_tokens)

Checked 17 October 2026 against OpenAI's tiktoken cookbook, OpenAI's token counting guide, Anthropic's docs (counting is free within rate limits) and Google's tokens guide.

How do token counts drive cost and context limits?

Cost is input tokens times the input price plus output tokens times the output price, and output usually costs several times more. The context window caps both together.

Worked example: the tool's opening prompt is 98 o200k_base tokens. On GPT-5.4 mini at US$0.75 per 1M input and US$4.50 per 1M output tokens (OpenAI's list price, 17 October 2026), a 500-token reply costs US$0.00225 against US$0.00007 for the prompt: about US$0.0023 per request, US$2.32 per 1,000, with the reply 97% of the bill. It uses 598 of the 400,000-token window, 0.15%.

The cost panel also applies long-prompt rates: OpenAI bills prompts over 272,000 input tokens on GPT-6 Astra, GPT-6.1 Sol and GPT-6 Luna at twice the input and 1.5 times the output rate for the whole request, and Claude Haiku 5.5 costs more above 100,000 prompt tokens. Reasoning counts as output: Google's price list says output prices include thinking tokens.

Common mistakes when counting tokens

  • Counting Claude or Gemini text with tiktoken. Their tokenizers differ; treat the figure as an estimate.
  • Counting only the user message. System prompt, tool schemas and history are input, resent every turn.
  • Pricing only the input. Output and reasoning tokens usually dominate.
  • Assuming English ratios. Vietnamese needs 3.4 times the tokens of English.
  • Reusing counts after a model change. Anthropic advises recounting for Claude Opus 4.7 and later.
  • Leaving no room for the reply. Prompt plus maximum output must fit the window.

How Olano helps

Olano runs AI agents on 18+ LLM providers, with your own provider keys on every plan (the provider then bills you directly), and an agent can change models without losing its conversations: that is the LangChain layer underneath, explained in switching LLM providers mid-conversation.

When a conversation outgrows the context window, the Deep Agents layer summarises older turns automatically (by default at 85% of the window), and MCP tool results over 5,000 tokens, the default limit, are saved to a file; see Deep Agents in production. Per-agent budgets cap daily, weekly or monthly spend, warn at 80% by default, and at the cap can switch to a cheaper model or stop the agent. Olano does not change how a model tokenizes text. See the Olano platform and plans and pricing.

FAQ

How many tokens are in 1,000 words?

About 1,150 tokens for plain English prose with OpenAI's o200k_base, by our measurement; text with JSON or code runs higher, and so do most other languages. Anthropic's rule of thumb for Claude's current tokenizer works out at about 1,800.

Does this token counter match OpenAI's tokenizer?

Yes for o200k_base, cl100k_base and o200k_harmony. It runs gpt-tokenizer 4.0.3, which matched OpenAI's tiktoken 0.14.0 token for token on all 25 texts we tested. The API's own count can be higher because it adds formatting tokens around messages.

Can I count Claude tokens here?

Only as an estimate: Anthropic does not publish the tokenizer for current Claude models, so the tool shows a range from its own rule of thumb. For an exact count, use Anthropic's token counting endpoint, free within rate limits.

Why does my API bill show more tokens than the counter?

The bill covers the whole request: system prompt, tool definitions, earlier turns, images and formatting tokens, plus every output and reasoning token. Paste the full prompt, and add the expected output in the cost panel.

More free tools

Free utilities for teams building AI agents. See all free tools.

Checked 17 October 2026 against OpenAI's, Anthropic's and Google's own pricing, model and token counting pages and tiktoken's model map. Exact counts use gpt-tokenizer 4.0.3 by Bazyli Brzoska (MIT licence), unmodified; its copies of OpenAI's rank files match tiktoken's SHA-256 hashes, and its output matched tiktoken 0.14.0 on all 25 texts we tested. Language figures use the Universal Declaration of Human Rights texts in the udhr package. Prices change; each vendor's page is authoritative. Olano is not affiliated with OpenAI, Anthropic or Google. Corrections to support@olano.ai.

Running agents on more than one model?

Tell us what your agents need to do; we will help you choose models and budgets.