AI utilities
Works Offline — No Internet Required
AI Prompt Token & Cost Analyzer — Local LLM Token Counter
Count prompt tokens, estimate API cost, and inspect context usage in your browser. GPT tokenizers run locally; other models are labeled as estimates. Nothing is uploaded.
- Mobile Friendly
- Accessibility Tested
- SEO Optimized
- Fast Loading
- Responsive
Version 1.0.0 · Last reviewed
How it worksShow guide
Introduction
Paste a prompt to estimate or exactly count tokens, see context-window usage, and project input/output cost. GPT-family counts use a bundled in-browser tokenizer. Other families are clearly labeled as estimates. The prompt never leaves this device.
Step-by-step
- Paste the prompt (or load the example)
- Pick a model profile and optional output-token assumption
- Read tokens, cost, waste, and context — then optimize locally if you want
Worked example
The sample prompt includes instructions, context, a duplicated example, and extra blank lines. The analyzer counts tokens, flags the duplicate example as potential waste, and can drop the exact duplicate locally.
Use cases
- Check whether a system prompt still fits a 128k context window
- Compare two prompt drafts before you pay for an API run
- Project monthly cost from tokens × list prices you control
Frequently asked questions
What is an AI token?
A token is a chunk of text a model bills and attends over — often a word piece, punctuation, or a whole short word. Token boundaries differ by tokenizer.
How many tokens are in my prompt?
This tool reports an exact count when a matching in-browser tokenizer is selected (GPT o200k/cl100k). Otherwise it shows an estimate labeled with a tilde.
Are token counts the same across AI models?
No. OpenAI, Anthropic, Google, and open-source models use different tokenizers. Do not copy a GPT count onto a Claude invoice.
How much does my prompt cost?
Estimated cost is input tokens × input price / 1,000,000, plus optional output tokens × output price / 1,000,000. Prices here are a dated snapshot you can override.
What is the difference between input and output tokens?
Input (prompt) tokens are what you send. Output tokens are what the model generates. You set an expected output size here because generation has not happened.
What is a context window?
The maximum tokens a model can consider at once, including prompt, conversation history, and usually the completion. Remaining capacity is theoretical, not a guarantee of usable output length.
How can I reduce prompt token usage?
Drop exact duplicate blocks, extra blank lines, and unused examples. Keep necessary context. This tool’s optimizer only applies those safe, local edits.
Does this tool send my prompt to a server?
No. Analysis, tokenization, cost math, and optimization run in your browser. Bestrao does not receive the prompt text.
Can I use this tool offline?
Yes, after the page (and the GPT tokenizer chunk, if you use an exact GPT profile) has loaded. There is no analysis API.
Are token counts exact?
Only when the UI says “Exact tokenizer” for a GPT profile using o200k_base or cl100k_base. Claude, Gemini, Llama, and Mistral counts are estimates.
Why does the token count differ between models?
Each family tokenizes text differently, and some profiles here are character-ratio estimates. Vendor APIs may also add framing, tools, or cached-input rules this page does not simulate.
Related tools
-
Word Counter
Count words, characters, sentences, paragraphs, and estimated reading time — privately in your browser.
-
Text Diff Checker
Compare two texts line by line, word by word, or character by character. Highlights additions and deletions privately in your browser.
-
JSON Formatter
Beautify, minify, and validate JSON in your browser — private and free.
-
Speech to Text
Transcribe microphone or audio files to text in your browser with Whisper ONNX — private, free, no upload.
Was this helpful?
Your feedback stays on this device only — it is not sent to the Bestrao team yet.