AI EngineerGuide

Token counter for OpenAI, Claude and Gemini

Paste a prompt and get token counts for OpenAI, Claude and Gemini, plus what it costs on any model.

Runs in your browser. Nothing you paste is uploaded.

Or drop a .txt, .md or .json file here, or . It's read in your browser.

299 characters Β· 53 words

Token counts by tokenizer
TokenizerTokensTypeUsed by
OpenAI o200k_base73exact Exact (gpt-tokenizer 4.1.0)GPT-4o, GPT-4.1, GPT-5.x, GPT-6, o-series
OpenAI cl100k_base75exact Exact (gpt-tokenizer 4.1.0)GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, text-embedding-3
Claude 4.7 and later112estimate characters Γ· 3.5 Γ— 1.3Opus 4.7+, Sonnet 5.x, Haiku 5.5, Fable, Mythos
Claude before 4.786estimate characters Γ· 3.5Sonnet 4.5/4.6, Haiku 4.5, Opus 4.6 and earlier
Gemini75estimate characters Γ· 4Gemini API models

Pick a model to see what these tokens cost as input or output, and how much of its context window they use.

View OpenAI tokens

Each colored block is one token. Only the first 2,000 tokens are shown.

The OpenAI counts for the sample text are already filled in. The two OpenAI tokenizer files (about 1.5 MB compressed) load the first time you edit the text.

How to use it

  1. Paste your prompt, document or JSON into the box, or drop a .txt, .md or .json file on it.
  2. Read the count for the tokenizer your model uses. OpenAI counts are exact; Claude and Gemini are labelled estimates.
  3. Pick a model to see the cost of those tokens as input or output and how much of its context window they use.

How we count tokens

TokenizerMethodSource
OpenAI o200k_base, cl100k_baseExact. Encoded in your browser with gpt-tokenizer 4.1.0 (MIT).Matches tiktoken test vectors (checked 2026-11-02)
Claude before 4.7Estimate: characters Γ· 3.5Anthropic glossary: “a token represents approximately 3.5 English characters” (checked 2026-11-02)
Claude 4.7 and laterEstimate: characters Γ· 3.5 Γ— 1.3Anthropic token counting docs: “approximately 30 percent more tokens” (checked 2026-11-02)
GeminiEstimate: characters Γ· 4Google Gemini tokens guide: “a token is equivalent to about 4 characters” (checked 2026-11-02)

Estimates are for English prose. They undercount code, JSON and most non-English languages, so leave headroom. Costs use prices from models.dev (checked 2026-11-02), cross-checked against official pricing pages; message formatting, tool definitions and images add tokens that this counter doesn’t see.

FAQ

How accurate is this token counter?

OpenAI counts are exact: they use the same o200k_base and cl100k_base encodings as OpenAI’s tiktoken, via the open-source gpt-tokenizer library. Claude and Gemini don’t publish browser tokenizers, so those rows are estimates from the providers’ own rules of thumb.

How many characters is a token?

For English text, roughly 4 characters per token on OpenAI and Gemini models, and about 3.5 characters on Claude models before Claude 4.7. Claude 4.7 and later models produce about 30% more tokens for the same text. Code, non-English text and JSON usually use more tokens per character.

Is my text uploaded anywhere?

No. Counting happens in your browser. The page downloads the OpenAI tokenizer files from this site, and your text stays in your browser.

How do I get an exact Claude or Gemini token count?

Call Anthropic’s free token counting endpoint (POST /v1/messages/count_tokens) or Gemini’s countTokens with the model you plan to use.

Which OpenAI models use o200k_base?

GPT-4o, GPT-4.1, the GPT-5 family and later models, and the o-series reasoning models use o200k_base. Older GPT-4, GPT-4 Turbo and GPT-3.5 Turbo models use cl100k_base.