Token
Counter
Accurately calculate, visualize, and estimate token counts and API costs across OpenAI GPT-4o, Claude 3.5, Gemini 1.5, and LLaMA models in real-time. Optimize your prompts and stay within context limits.
| Model | Est. Tokens | Context Max | Cost (Input / 1M) | Est. Prompt Cost |
|---|
Minimize Redundant Whitespace & Indents
JSON minification and trimming trailing indentation in code snippets can cut token counts by 15% to 30%, especially in large batch prompts.
Prefer Markdown Over Verbose XML/HTML
Unless your prompt specifically trains an agent to parse complex XML trees, clean Markdown lists and headings token-compress much tighter than HTML tags.
Understand Sub-Word Splits
Common English words usually consume 1 token. Unusual names, hexadecimal IDs, UUIDs, and foreign alphabets often decompose into multiple sub-word chunks.
Cache System Instructions
Modern LLMs (Claude Prompt Caching, Gemini Context Caching, OpenAI Prompt Caching) discount repeated system prompts by up to 90%. Structure prefixes predictably.
o200k_base vocabulary (~200,000 tokens), which packs non-English text and code into fewer tokens than older cl100k_base (GPT-4) or Claude's custom tokenizers.