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.
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.
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.