Paste a prompt or document to count its tokens exactly with OpenAI's tokenizers (o200k_base for GPT-4o and newer, cl100k_base for GPT-4). Every token is highlighted so you can see how the model splits your text, and the cost box turns the count into an input price estimate.
Last updated:
Token boundaries
Loading tokenizer…
Advertisement
Advertisement
How to use the AI Token Counter
Paste your text into the box, or open a .txt, .md, .json or code file.
Pick the tokenizer that matches your model: o200k_base for GPT-4o and newer OpenAI models, cl100k_base for GPT-4 and GPT-3.5 Turbo.
Read the count in the green box. It updates as you type.
Inspect the tokens in the colored view below; turn on token IDs to see the numbers the model receives.
Estimate cost: choose a price preset or type your provider's current price per 1M input tokens and the number of requests.
Typical token counts
These rules of thumb come from OpenAI's guidance for English text with its tokenizers. Real counts depend on the text, so use the counter above for anything that matters.
Original GPT-3 models (davinci, curie, babbage, ada)
A larger vocabulary usually means fewer tokens for the same text, especially for code and non-English languages, which is why the same prompt is often cheaper to send to GPT-4o than to GPT-4.
Tips to reduce token usage
Trim boilerplate: long system prompts are sent with every request, so a 1,000-token prompt across 10,000 requests is 10 million input tokens.
Prefer compact formats: minified JSON, CSV or short keys use fewer tokens than pretty-printed JSON with long field names.
Watch whitespace: indentation and repeated blank lines become tokens too; turn on "Show spaces and line breaks" to spot them.
Summarize history: in long chats, replace old turns with a short summary instead of resending the full conversation.
Use cached prompts: many providers discount repeated prompt prefixes; put the stable part of your prompt first.
Frequently asked questions
What is a token?
A token is the unit of text a language model reads and writes. Tokenizers split text into common chunks: frequent English words are often a single token (including the space before them), while rare words, numbers, code and many non-English scripts are split into several tokens. In English, one token averages roughly four characters, but this varies a lot by text.
Which tokenizer should I choose?
OpenAI's GPT-4o, GPT-4o mini, GPT-4.1 and o-series reasoning models use o200k_base. GPT-4, GPT-3.5 Turbo and the text-embedding-3 models use cl100k_base. p50k_base and r50k_base are for older Codex and GPT-3 models.
Can I count tokens for Claude, Gemini or Llama?
Those models use their own tokenizers, so counts here are an approximation for them. Anthropic does not publish a downloadable tokenizer for current Claude models; for exact numbers use the provider's token counting endpoint or the usage figures returned with each API response.
Why is the API bill higher than the count here?
This page counts only the text you paste. A chat request also includes the system prompt, message formatting tokens, tool definitions and images, and you are billed separately for output tokens (and reasoning tokens on reasoning models), which are usually priced higher than input.
How is the cost estimate calculated?
Cost = tokens ÷ 1,000,000 × price per 1M input tokens × number of requests. Presets reflect public list prices for standard input tokens as of mid-2025; batch discounts, cached-input rates and price changes are not included, so edit the price to match your plan.
Is my text sent to OpenAI or anyone else?
No. The tokenizer runs entirely in your browser. Only the tokenizer files are downloaded from a public CDN the first time; your text stays on your device.
Why do Chinese, Japanese or emoji use so many tokens?
Byte-pair tokenizers were trained mostly on English text, so characters from other scripts are less often merged into large tokens. A single Chinese character can be one or two tokens and an emoji can take several, because the tokenizer works on UTF-8 bytes.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.