// free tool · no signup

Token Counter
for LLMs

Paste your prompt and instantly see how many tokens it uses in each model — with API cost estimate. Free, no signup.

0 caracteres0 palavras
ModeloTokens (~)Custo input
GPT-4o / GPT-4
GPT-3.5 Turbo
Claude 3.5 Sonnet
Claude 3 Haiku
Gemini 1.5 Pro
Llama 3 (70B)

Estimativa baseada nos padrões BPE documentados de cada modelo (±5% para texto comum). Nenhum provedor disponibiliza tokenizador JS oficial — para contagem exata use os SDKs Python oficiais.

Seu prompt é tecnicamente bom?
Score 0–100 em clareza, especificidade, estrutura e robustez.
Avaliar no PromptEval →

How to count tokens for Claude, GPT-4, and Gemini

Language models don't process text as characters or words — they use tokens, text units defined by each model's tokenizer. In English, 1 token typically corresponds to ~4 characters or ~¾ of a word. This free Anthropic token counter lets you estimate token usage for Claude, GPT-4, and Gemini before sending a request to the API.

Claude token counter: Anthropic's Claude models — Haiku, Sonnet, and Opus — use a BPE-based tokenizer similar to GPT-4's cl100k_base. For English prose, Claude tokenizes at roughly 1 token per 4 characters. Claude Haiku and Sonnet 3.5 both support a 200K context window, making them among the most capable models for long-document tasks. When you count tokens for an LLM like Claude, you can plan prompt length, avoid truncation errors, and estimate API costs before a single API call.

GPT-4 and Gemini: GPT-4o uses the cl100k_base tokenizer (via OpenAI's tiktoken library) and has a 128K context window. Gemini 1.5 Pro uses SentencePiece and supports up to 1 million tokens. While all three models handle English text at a similar ratio, multilingual text, code, and structured data like JSON can tokenize very differently across providers.

Values in this tool are estimates based on documented averages per model. For exact counts in production, use each provider's official tokenization endpoint. The cost estimate shows only the input cost — output cost depends on response length, which varies by task.

Why do tokens matter?
Each model has a maximum token limit per request (context window). Exceeding it causes errors or silent truncation of your prompt.
Claude vs GPT-4: tokens
Both use ~4 chars/token for English. Claude tends to be slightly more efficient on structured text like JSON and code.
How to reduce tokens?
Eliminate redundancy, use lists instead of paragraphs, prefer direct instructions, and move static context to the system prompt.

Frequently asked questions

How do I count tokens in Claude?
To count tokens in Claude, paste your text into the PromptEval token counter above. The tool estimates token count using BPE-based algorithms calibrated for Claude's tokenizer — the same approach Anthropic documents for Claude Haiku, Sonnet, and Opus. For exact counts in production, use Anthropic's official tokenization API endpoint.
What is the token limit for Claude Haiku?
Claude Haiku 3.5 (claude-haiku-3-5-20241022) supports a context window of 200,000 tokens — covering both input and output tokens combined per request. Claude Haiku is Anthropic's fastest and most cost-efficient model, designed for high-throughput tasks. Input costs are $0.80 per million tokens and output costs are $4.00 per million tokens.
Why do tokens matter for LLM prompts?
Tokens determine three critical things: (1) whether your prompt fits within the model's context window — exceeding it causes errors or silent truncation; (2) how much you pay per API request, since all LLM providers charge per token; (3) how much context the model can see at once, which affects response quality for long documents and complex tasks.
How is token counting different from word counting?
Words split on spaces; tokens split based on each model's vocabulary (typically BPE — Byte Pair Encoding). In English, 1 token approximates 0.75 words or ~4 characters. But in code, JSON, numbers, and non-English languages the ratio changes significantly. A URL might tokenize into 8–15 tokens despite being 3–4 words. This is why token counting matters more than word counting for LLM cost estimation.