#token count
A SMALL TOOL FOR BETTER PROMPTS

Token Counter

Count tokens and estimate LLM input costs for GPT-5, Claude, Gemini, DeepSeek and Grok.
A free AI token counter with local processing, token previews and model price presets.

Same text, five providers. Estimates are approximate references, not verified counts for every model version.

01

Your text

TRY AN EXAMPLE
◈ Your text stays on this device · Files up to 5 MB · 1,000,000 characters0 characters
03

Inside your tokens

A closer look at how your text is split
⌁Your tokens will appear here as you type.
Each color represents a token. Hover to see its ID.
01 /

Tokens ≠ words

A token can be a word, punctuation, or part of a character. Language and formatting affect the count.

02 /

Choose the right encoding

GPT-5 and DeepSeek V4 Pro use local tokenizers. Claude uses a legacy reference; Gemini uses Gemma 4; Grok uses a byte-based heuristic. Always check the version and accuracy label.

03 /

Private by design

No API key, no text uploads to a server, no saved prompts. The tokenizer runs locally in your browser. Google Analytics measures site visits; entered text is not sent with those measurements.

* Words use language-aware segmentation; Chinese words may contain more than one character.

How accurate are these counts?

OpenAI / GPT-5: local raw-text counts using o200k_base, the GPT-5 encoding mapped by OpenAI’s tiktoken. Compare text with the official OpenAI Tokenizer. Chat messages, tool definitions and media can add tokens.

Claude: This local reference uses Anthropic’s legacy tokenizer, which is not accurate for Claude 3 and later. Claude 4.7 and later use a newer tokenizer, so counts from older versions should not be reused. The visible pieces and IDs belong to that legacy tokenizer, not your current Claude model. Use the official token-counting API to check your model.

Gemini: Google’s official Gemma 4 vocabulary. Google’s local SDK maps Gemini 3.5 Flash, 3.1 Flash-Lite and 3.1 Pro Preview to Gemma 4. Local counts cover raw text; they are not verified counts for every Gemini version or complete API requests. Use the official countTokens API for model-specific verification.

DeepSeek: DeepSeek’s official V4 Pro vocabulary, pinned to a specific release. Counts cover raw text, excluding chat templates and media. Other versions may use different tokenizers. Check the API usage for billing.

Grok: rough budgeting estimate: UTF-8 bytes divided by 4, rounded up. This heuristic is used in xAI’s open-source Grok Build for budgeting; it is not a model tokenizer and may differ substantially for language, code, punctuation or model versions. Token pieces and IDs are unavailable. For a chosen model, use the official xAI Tokenize API.

No text is sent to any provider. All vocabulary files are served locally. First use loads the local tokenizer; future model versions require an explicit update. Reference review: 29 September 2026.

UNDERSTAND YOUR PROMPT

Token counting for AI prompts, text and code

A token count measures how an LLM splits text into units, not how many words it contains. Language, punctuation, code and the model’s tokenizer can all change the result. Use this LLM token counter to compare the same text before choosing a model.

How to count tokens

  1. Paste a prompt, article or code, or upload a UTF-8 text file.
  2. Choose a provider to view its token count or labeled estimate.
  3. Select a pricing model to estimate the input cost automatically.

Text files can be up to 5 MB, with a limit of 1,000,000 UTF-16 characters. Token previews show the first 1,200 tokens; the total counts the entire accepted text.

Try the token counter ↑

LLM token cost calculator

Input cost = token count ÷ 1,000,000 × the model’s input price. For example, 10,000 input tokens at $1.25 per million tokens cost about $0.0125.

The calculator uses standard paid-tier input prices from official pricing pages, checked on 29 September 2026. It excludes output, cached-input discounts, batch discounts, tools, taxes and message overhead. Long-context tiers and DeepSeek’s peak/off-peak range are included.

Read the counting methods ↓

Claude token counter and cost calculator

Use the Claude token calculator for a rough offline reference and an input-cost estimate for the selected Claude model. The local counter uses Anthropic’s legacy tokenizer, which is not accurate for Claude 3 and later.

Choosing a newer pricing model changes the price, but does not make the legacy token estimate match that model. Token previews belong to the legacy reference. For model-specific counts, use Anthropic’s official token-counting API.

Claude counting documentation ↗

OpenAI token cost calculator for GPT-5

The GPT-5 counter uses o200k_base for raw text. Select GPT-5 to see token pieces, token IDs and an input-cost estimate at its listed standard price.

This counts the text you supply. A complete API request can include additional tokens for message roles, tools, images or other inputs. Your API usage remains the reference for billing.

GPT-5 model and pricing ↗

Token counter FAQ

What is a token counter?

A token counter splits text using a tokenizer and counts the resulting units. Tokens can represent words, word fragments, punctuation or part of a character. The count depends on the tokenizer, so different models may produce different totals for the same text.

How is token count different from word count?

Word count measures language-aware word segments. Token count measures the units processed by a model. A word may contain several tokens; Chinese text, emoji and code can have very different token-to-word ratios.

Is this Claude token counter accurate for current models?

No. Claude results are rough offline estimates from a legacy tokenizer, not verified counts for current Claude models. The Claude token cost calculator combines that estimate with the selected model’s published input price. Use the official Claude count_tokens API for model-specific counts.

How does the Claude token price calculator work?

Select Claude, then choose a Claude pricing model. The calculator multiplies the offline token estimate by that model’s standard input rate per million tokens. Prices are a dated snapshot, not a live feed, and estimated input cost does not include output or other API charges.

Does this AI token counter support other LLMs?

Yes. It includes GPT-5, Claude, Gemini, DeepSeek and Grok. GPT-5 and DeepSeek V4 Pro use local tokenizers for their stated raw-text scope. Gemini uses a Gemma 4 reference, Claude uses a legacy reference and Grok uses a rough byte-based estimate. Check each provider’s accuracy label.

Is token counting free, and is my text private?

This tool is free to use and does not require an API key. Text processing happens in your browser. Your prompt or uploaded file contents are not sent to a model provider, and the tool does not save them.

Which files can I upload?

Upload UTF-8 plain-text files, including TXT, Markdown, CSV, JSON, HTML, JavaScript, Python, XML, YAML and logs. Files are limited to 5 MB and 1,000,000 UTF-16 characters. PDFs, Word documents, spreadsheets and images are not parsed. Markup and separators in text files are counted as part of the original text.