Token Counter - LLM Token & Cost Estimator
Count tokens with the encodings used by popular LLMs and estimate request cost from public pricing. Text is processed only in your browser.
Input text
Costs use public per-million-token pricing and are estimates only; refer to your provider invoice.
Result
Tokenization and counting run locally. Text is never uploaded.
About This Tool
Estimating tokens before calling an LLM helps you stay within context limits and understand cost. This tool counts with the same encodings used by popular models.
Besides token count, it reports characters, words and estimated input/output cost. Text is tokenized locally and never uploaded.
Key Features
Mainstream encodings
Supports o200k_base and cl100k_base for common GPT models.
Cost estimation
Calculates input, output and total cost from public per-million pricing.
File input
Upload txt, md, json and similar text files directly.
Local processing
Prompts and documents never leave the browser.
When to Use It
Respect context limits
Check tokens before combining long documents.
Estimate call cost
Budget a single request or a batch before running it.
Optimize prompts
Compare token usage across prompt variants and trim redundancy.
How to Use It
- 1Paste text or upload a file.
- 2Select a model and enter expected output tokens.
- 3Count and review tokens and cost.
- 4Adjust text length or model choice accordingly.
Frequently Asked Questions
Is the count exactly the same as the provider?
It matches when the encoding is the same, though tokenizer versions can differ slightly. Claude models use an approximation.
Where do prices come from?
Built-in public pricing may change over time; refer to your actual invoice.
Is text uploaded?
No, tokenization and counting run locally.
