/ Tool 01
Token Counter
Count the tokens in a prompt or document, then price the call before you spend it. 50+ models, each with its own tokenizer, covering OpenAI GPT-5, Anthropic Claude 5, Google Gemini, Meta Llama, Mistral, and xAI Grok. Paste the text and pick the model family to read the number your bill will actually use.
Total Tokens
0
Est. Cost
$0.000
Per 1M Input
$—
Per 1M Output
$—
Tokens
—
How It Works
Select Your Model
Choose from 50+ models: OpenAI GPT-5.6/5.5/5.4/5, Anthropic Claude 5, Google Gemini 2.5, Meta Llama 4, Mistral Medium 3.5, xAI Grok 4.6, and more.
Paste Your Prompt
Enter your system prompt, user message, or full conversation history.
View Results
See token counts, context usage percentage, and estimated API costs.
How to Use the Token Counter
Start with the model family. OpenAI, Anthropic, Google Gemini, Meta Llama, Mistral, xAI Grok, and Perplexity each tokenize text differently, so the same string is a different count in each of them. The counter runs the matching tokenizer per family, which is the number the API bill uses. Paste a prompt, a document, or a whole conversation and the count updates as you type, so you can size against a context window or a budget while you write.
The cost estimate sits next to the raw count, computed at the model's published input and output rates. The number you are optimizing becomes dollars instead of an abstract unit. To price a real request, paste the system prompt and the user input together and read the combined figure once.
Two moments make this pay. Before a system prompt ships, its tokens ride every single request, so every token you cut multiplies across your traffic. When a call starts clipping the context limit, the counter shows how far over you are and which part to trim first.
Why This Runs 100% in Your Browser
A hosted counter has to read your text, and the text you are counting is often the sensitive part: the production prompt, a client document, a conversation with data in it. This one runs the tokenizer in your browser. Your text never leaves the page, and the count comes from the same per-vendor logic the APIs apply. You get the exact number at the exact price, and nothing gets handed to a third party.
Code & CLI Equivalents
In a script, the provider's own tokenizer is the reference. Run the count, multiply by the published rate, and you have the per-call cost, which is the number worth optimizing.
# bash + python: tiktoken count + cost
pip install tiktoken
python3 - <<'EOF'
import tiktoken
enc = tiktoken.encoding_for_model("gpt-4o")
n = len(enc.encode(open("prompt.txt").read()))
print("%d tokens x $2.50/1M = $%.6f per call" % (n, n * 2.5 / 1e6))
EOF Frequently Asked Questions
Why does the same text have different token counts per model?
Each vendor ships its own tokenizer: a different vocabulary and different splitting rules for common words, code, and non-Latin scripts. A string at 1,000 tokens on one model lands at 900 or 1,100 on another. Pick the family you are billing against and the count matches the bill.
How accurate is the cost estimate?
Token count times the model's published per-token rates, so it is as accurate as the published pricing. It does not know about promotional discounts, batch pricing, or committed-use deals. Treat it as the list-price number for budgeting.
Should I count the system prompt separately from the user input?
For budgeting, no: paste the whole request. For optimization, yes. The system prompt rides every request, so isolating it shows what your per-call baseline costs before a user message arrives.
Does it work with non-English text?
Yes, and it matters more there. Many languages tokenize to several tokens per word, so a French or Japanese prompt of similar length usually costs more than its English equivalent. Per-family counting is the only way to see that honestly.
Is the text I paste uploaded?
No. Tokenization and cost estimation run in your browser, and nothing is transmitted or logged. That is the default you want when counting production prompts or client documents.