TokenCalculator.dev is a browser-based LLM token calculator that counts tokens in text, code, PDF, DOCX, and image files against current OpenAI, Anthropic Claude, Google Gemini, and DeepSeek models, with live cost estimates and no content upload.
What is TokenCalculator.dev?
TokenCalculator.dev is a standalone web tool that measures the token count of your input across multiple AI providers. You paste text or attach documents and images, and it reports token count, context-window fit, and estimated input cost for each provider's models. The entire calculation runs locally in your browser; no prompt or file is ever uploaded. The service is hosted at tokencalculator.dev and provides dedicated counters per provider.
Key Features
- Local-only processing — Text, PDF/DOCX extraction, and image-dimension reading happen in your browser; no prompt, file, or image is sent to TokenCalculator.dev or another server.
- Multi-provider coverage — OpenAI, Anthropic Claude, Google Gemini, and DeepSeek model cards show every available model; provider and model details are displayed.
- Document support — Upload a text-based PDF or DOCX up to 12 MB per file; readable text is extracted locally and combined with the prompt editor.
- Code and data files — Plain text, Markdown, CSV, JSON, JavaScript, TypeScript, Python, Go, Rust, Java, C/C++, HTML, CSS, XML, YAML, TOML, SQL, and shell files are supported.
- Image token estimation — Add PNG, JPEG, WebP, or GIF to compare visual-token footprints using documented tile, patch, or media-token rules.
- Exactness labeling — OpenAI text uses local o200k_base BPE; Claude, Gemini, and DeepSeek use deterministic Provider-Calibrated UTF-8 Token Projections; every result shows its method and accuracy level.
- Context and cost checks — Input cost is calculated as input tokens divided by one million times model input price, with context-window overflow warnings.
- Current pricing data — Rates refresh from Models.dev, with the bundled registry available as an offline fallback.
Who should use TokenCalculator.dev?
- LLM application developers: Estimate token usage and input cost for a prompt before building an API call, and check context-window fit.
- AI product managers: Compare provider pricing for the same workload to choose a model with enough context capacity.
- Data engineers: Measure CSV and JSON files plus instructions as one workload to evaluate batch-processing economics.
- Writers and researchers: Count tokens in a PDF or Word document without copying its contents page by page.
What can you do with TokenCalculator.dev?
- Document ingestion pricing: Extract a text-based PDF locally, measure its full payload, and compare context fit and input cost across OpenAI, Claude, Gemini, and DeepSeek.
- Vision request budgeting: Add an image, combine its dimensions with prompt text, and apply documented tile, patch, or media-token rules for each supported vision model.
- Repository review measurement: Attach code, configuration, and documentation files as one workload before selecting a model with enough context capacity.
- Batch-processing comparison: Measure structured data and instructions together to compare provider input rates before committing recurring workloads.
How does TokenCalculator.dev work?
The calculation pipeline runs in four visible steps: input text, file, or image is read locally; a counting method (exact BPE or deterministic projection) is applied; context fit is checked with an overflow alert; and input cost is calculated at current provider rates. Users can copy a Markdown breakdown or share a calculation link.
FAQ
Does TokenCalculator.dev upload my prompts or files?
No. Text, PDF and DOCX extraction, image-dimension reading, and token calculations run in your browser. Zero prompts, document contents, or uploaded images are sent to TokenCalculator.dev or another calculation server.
Which file types can I count tokens from?
You can count tokens in text-based PDF and DOCX documents, code and data files (plain text, Markdown, CSV, JSON, JavaScript, TypeScript, Python, Go, Rust, Java, C/C++, HTML, CSS, XML, YAML, TOML, SQL, and shell), and images (PNG, JPEG, WebP, GIF). Each file can be up to 12 MB.
How accurate are the token counts?
OpenAI text counts use the matching local BPE encoding. Other providers are clearly labeled as deterministic projections unless they publish an exact formula. Image counts use provider-published visual-token rules, and a result says image unavailable when no documented rule exists.
Can I count tokens in a scanned PDF?
No. Scanned PDFs need OCR and are intentionally rejected rather than returning a misleading result. Only text-based PDFs are supported.
Why can the API report a slightly different count?
Providers can add message wrappers, system instructions, tools, or model-specific processing. The accuracy badge and methodology page explain what this calculator includes.