Token Counter — Estimate LLM Token Counts & API Costs
Estimate the number of tokens in your prompt, code snippet, or document — plus the approximate API cost across Claude, GPT, Gemini, and other models. No account or upload required.
Paste your text to count tokens
Enter a prompt, code snippet, or document. Token counts are estimates — actual counts depend on the model's tokenizer.
Private by design
This tool runs entirely in your browser. No text is uploaded, stored, or transmitted. Use it for any prompt, code snippet, or document without worrying about data exposure.
How to use this tool
- Paste your prompt, code, or document into the text area.
- See the estimated token count, characters, words, and lines instantly.
- Select a model to see the estimated API cost for input and output tokens.
- Use the estimate to budget your AI API usage or compare model costs.
When to use the official tokenizer
This tool uses a heuristic approximation. For exact token counts — especially before making cost commitments or debugging prompt limits — use the provider's official tool:
- Anthropic: Claude Tokenizer (official)
- OpenAI: tiktoken (open-source)
- Google: Gemini Tokenizer
Related tools
JSON Formatter & Validator
Format, validate, and minify JSON — debug AI tool-call outputs instantly.
AI Coding Tools Directory
Compare AI coding tools, Claude Code alternatives, and developer workflows.
FAQ
Is this token counter accurate?
Token counts are estimates based on heuristics. Each LLM provider uses a different tokenizer. Always use the official tool (e.g. Anthropic's token counting endpoint, OpenAI's tiktoken, or Google's tokenizer) for exact counts before making cost commitments.
Does this tool send my text to a server?
No. This tool runs entirely in your browser. Nothing is uploaded or stored on any server.
How do you estimate tokens?
We use a rough heuristic: approximately 4 characters per token for English text and 1.5 characters per CJK character. This is an approximation — actual tokenization depends on the specific model.
Which models are included in the cost estimate?
Claude Sonnet 4.6, Claude Opus 4.7, Claude Haiku 4.5, GPT-4o, Gemini 2.5 Flash, DeepSeek V3, and Kimi K3. Prices are as of July 2026 and may change.