Token Counter & Cost Calculator
Count estimated input tokens for system instructions, text prompts, code snippets, and attached images—then calculate per-request and monthly API costs in US dollars directly on your device. Drop PNG, JPG, or WebP screenshots to measure exact pixel dimensions locally or enter dimensions manually, compare OpenAI, Anthropic Claude, and Google Gemini image tiling formulas side by side, factor in cached input discounts or batch API pricing, and verify whether your combined prompt fits inside a model context window with zero uploads.
100% Local Process
Prompts and images stay on your device — never uploaded
Text + Image Inputs
Combines system prompts, text, and vision image tiles
Editable Model Rates
Compare OpenAI, Claude, Gemini, or custom per-1M pricing
Image Inputs (Upload or Enter Dimensions)
Reads width & height locally on your device to calculate vision input tokens.
Drag and drop files here, or
Supported: PNG, JPEG, WebP • Max 25 MiB per file • Up to 10 files • 100 MiB total batch limit
Processed locally in your browser — files never leave your device.
Or add image dimensions directly
Total Input Tokens
0
Cost / Request
$0.004000
- Uncached input (0 tokens)
- $0.00
- Expected output (500 tokens)
- $0.004000
- Batch total (1 request)
- $0.004000
Model & Pricing Settings
Reference rates are editable — confirm current billing tiers with your provider.
85 base + 170 per 512×512 tile (High) or flat 85 (Low)
Side-by-Side Model Cost Comparison
| Model | Input Tokens | Image Tokens | Cost / Request | 1 Requests |
|---|---|---|---|---|
| GPT-4.1OpenAI | 0 | 0 | $0.004000 | $0.004000 |
| GPT-4.1 miniOpenAI | 0 | 0 | $0.000800 | $0.000800 |
| GPT-4oOpenAI | 0 | 0 | $0.005000 | $0.005000 |
| Claude SonnetAnthropic | 0 | 0 | $0.005000 | $0.005000 |
| Claude HaikuAnthropic | 0 | 0 | $0.000250 | $0.000250 |
| Gemini 2.5 FlashGoogle | 0 | 0 | $0.001250 | $0.001250 |
How to Use Token Counter & Cost Calculator
- Optionally paste reusable system instructions into the System Prompt box, then type or paste your main text, prompt, JSON payload, or code into the User Prompt box.
- To include vision inputs, drag and drop up to 10 PNG, JPG, or WebP images into the dropzone (only pixel dimensions are read locally on your device) or enter Width, Height, and Quantity manually.
- Select a reference Model Pricing Preset (OpenAI, Anthropic, Google, or Custom) or edit the Input, Cached Input, and Output USD per 1M token fields directly.
- Set your Expected Output Tokens, adjust Cached Input Share (%) if your workflow reuses prompt prefixes, and toggle Batch API 50% discount when planning offline batch jobs.
- Enter the Number of Requests (such as 1, 100, 1,000, or 10,000) to project total budget alongside the single-request cost and context window utilization bar.
- Review the Side-by-Side Model Cost Comparison table at the bottom or click Copy breakdown to paste the token and USD summary into a budget sheet or ticket.
How It Works & Formula Explanation
Token Counter & Cost Calculator runs 100% locally on your device so draft prompts, private customer tickets, code, and screenshots never leave your browser. 1. Subword-Aware Text Token Estimation: Language model APIs break text into small pieces called tokens—roughly three-quarters of an English word on average, though numbers, punctuation, code symbols, emojis, and non-Latin scripts split differently. As you type, the calculator separates words, digits, punctuation, indentation, and multi-byte characters to give a fast, responsive estimate for both your system prompt and user prompt. 2. Provider-Specific Image Input Token Formulas: Vision APIs convert images into billable input tokens based on pixel dimensions rather than file size in kilobytes. When you drop an image file or type dimensions manually, the calculator applies the selected provider's documented scaling and tile formula—so you can see how a 1920 × 1080 screenshot is billed differently across OpenAI, Claude, and Gemini. 3. Flexible Per-Request & Batch Cost Projections: Combined input tokens (system prompt + user prompt + images) are split into standard and cached input portions, paired with your expected output tokens, and multiplied by the per-1-million-token USD rates. Changing any model preset or typing your own custom rates recalculates every total immediately.
Methodology & Formula
1. Total Input & Combined Tokens: Total Input Tokens = System Prompt Tokens + User Prompt Tokens + Image Input Tokens Total Combined Tokens = Total Input Tokens + Expected Output Tokens 2. Vision Image Token Formulas: • OpenAI 512px Tiles: - Low detail: flat 85 tokens per image - High detail: scale proportionally to fit inside 2048 × 2048 px, then scale so shortest side <= 768 px; Tiles = ceil(Width / 512) × ceil(Height / 512); Tokens = 85 + (170 × Tiles) • Claude Pixel Area: - Scale proportionally so longest side <= 1,568 px; Tokens = ceil((Width × Height) / 750) • Gemini 768px Tiles: - Images <= 384 × 384 px: flat 258 tokens - Larger images: Tiles = ceil(Width / 768) × ceil(Height / 768); Tokens = Tiles × 258 3. API Cost Formula (USD): Uncached Input Cost = (Uncached Input Tokens / 1,000,000) × Input Rate Cached Input Cost = (Cached Input Tokens / 1,000,000) × Cached Rate Output Cost = (Expected Output Tokens / 1,000,000) × Output Rate Total Batch Cost = (Uncached Input Cost + Cached Input Cost + Output Cost) × Number of Requests (When Batch API 50% discount is enabled, all three rates are multiplied by 0.5.)
Worked Examples
Estimating a text-only prompt + 500-token reply on GPT-4.1
- Input
- System prompt (~40 tokens) + User prompt (~1,200 tokens), 0 images, Expected Output: 500 tokens, Rate: $2.00/1M in & $8.00/1M out, 1,000 requests
- Output
- 1,240 input tokens + 500 output tokens = $0.006480 per request ($6.48 for 1,000 requests)
Input cost is (1,240 / 1,000,000) × $2.00 = $0.002480 and output cost is (500 / 1,000,000) × $8.00 = $0.004000, totaling $0.006480 per call or $6.48 across 1,000 calls.
Counting image tokens for a 1920 × 1080 screenshot across providers
- Input
- One 1920 × 1080 px screenshot (High detail) with a 150-token prompt
- Output
- OpenAI High: 1,105 img tokens (6 tiles) | Claude: 1,843 img tokens | Gemini: 1,548 img tokens (6 tiles)
OpenAI scales 1920 × 1080 down to 1365 × 768 (3 × 2 = 6 tiles → 85 + 6 × 170 = 1,105 tokens). Claude scales longest edge to 1568 × 882 (ceil(1,382,976 / 750) = 1,844 tokens). Gemini divides into 3 × 2 = 6 tiles of 768 px (6 × 258 = 1,548 tokens).
Projecting 10,000 monthly requests with 60% prompt caching
- Input
- 4,000 total input tokens (60% cached = 2,400 cached / 1,600 uncached), 400 output tokens, Claude Sonnet ($2.00 in / $0.10 cached / $10.00 out), 10,000 requests
- Output
- $0.007440 per request ($74.40 total for 10,000 requests instead of $120.00 uncached)
Caching 60% of repeated system and document input cuts input spend from $80.00 to $34.40 across 10,000 calls, saving $45.60 per month.
Privacy, Accuracy & Limitations
Data Processing: All text prompts, system instructions, uploaded image dimension checks, and cost calculations run 100% locally inside your web browser on your own device. Your prompts, code, and images are never uploaded to Toolmify servers, never logged, and never stored.
Limitations: Text token counts are fast local estimates because each model provider uses its own proprietary vocabulary and special message-framing overhead (exact billed counts typically fall within roughly 5% to 10% for English prose, and may vary more for dense code or non-Latin scripts). Built-in model rates are editable reference values—provider pricing, long-context tier thresholds, and vision tiling rules change periodically, so always confirm current rates on your provider's official pricing page before committing budgets.
Frequently Asked Questions
How many characters or words equal one token?
In everyday English text, 1 token averages roughly 4 characters or about three-quarters of a word (so 100 tokens is approximately 75 words). Numbers, punctuation, formatting spaces, code syntax, emojis, and non-English scripts often use more tokens per character.
How are image input tokens calculated?
Image tokens depend on pixel width and height rather than file size in KB or MB. OpenAI splits high-detail images into 512 × 512 px tiles (85 base + 170 per tile, or flat 85 in low detail), Claude estimates roughly (width × height) / 750 after capping the long edge at 1,568 px, and Gemini charges 258 tokens for small images (up to 384 × 384 px) or 258 tokens per 768 × 768 px tile.
Are my prompts or uploaded screenshots sent to Toolmify servers?
No. Everything runs 100% locally inside your web browser. When you drop an image file, your browser reads only its pixel width and height directly on your device—no text or image bytes are ever uploaded or stored.
Why might my final API invoice differ slightly from this estimate?
Each provider uses a distinct tokenizer and adds small per-message wrapper tokens for roles, tool schemas, or system fields. Providers may also apply different pricing tiers for very long prompts, cached writes, or regional endpoints. Use the editable rate inputs to match your exact account pricing.
How does the Cached Input Share slider affect cost?
When you reuse the same system prompt, reference document, or conversation prefix across multiple requests, many providers discount repeated cached input tokens by 50% to 95%. Setting Cached Input Share splits your total input tokens between standard and cached per-1M rates automatically.
Should I choose High or Low image detail for OpenAI cost estimates?
Low detail always costs a flat 85 tokens per image regardless of dimensions and works well for coarse classification or basic scene checks. High detail splits larger images into 512 × 512 tiles so models can read fine text, UI screenshots, receipts, or charts accurately.
Can I calculate costs for a custom or private model not listed in the presets?
Yes. Select Custom Model / Pricing (or overwrite the Input, Cached Input, and Output USD per 1M token fields on any preset) and pick either a standard vision tile formula or Custom Flat Rate per image.
Does compressing an image file size in KB reduce image token count?
Compressing JPEG quality alone without changing pixel dimensions does not reduce vision token count because providers calculate tokens from width and height in pixels. To lower image input tokens, resize the image to smaller pixel dimensions (for example with our Image Crop & Resizer) before sending it.
