Token Calculator

Token Calculator - Privacy-first browser-based token calculator to count tokens in text, files, and images for all major LLM providers

Launched today

TokenCalculator.dev is a browser-hosted, privacy-first token counting tool that runs all calculations locally on your device, no user content is uploaded to external servers. It supports text prompts, code files, PDF, DOCX documents, and common image formats, returning live token counts and estimated API costs across 35+ models from 9 popular LLM providers. It is built for AI developers, LLM workflow planners, and teams comparing pricing across different generative AI services to estimate workload costs accurately before making API calls.

1ViewsAI DevToolsFreePrivacy FocusedOffline CapableLarge Language ModelClaudeGPTGemini

Core Features

All processing runs entirely in your browser. No pasted text, uploaded documents, or image content leaves your local device at any point. Only public model metadata may be refreshed remotely for pricing updates.

Supported input types include plain text, code files (JavaScript, TypeScript, Python, Go, Rust, Java, C/C++, HTML, CSS, XML, YAML, TOML, SQL, shell), data files (CSV, JSON), text-based PDF, DOCX, and raster image formats (PNG, JPEG, WebP, GIF). The maximum file size per upload is 12 MB. Scanned PDFs are rejected automatically to avoid returning misleading low-token results.

The tool supports 35 current models from 9 major LLM providers: OpenAI, Anthropic, Google, DeepSeek, Qwen, Moonshot Kimi, xAI Grok, Z.ai GLM, and Meta. It displays input token counts, context window fit status, and estimated input cost for every model.

Calculation Methodology

OpenAI token counts use exact local o200k_base BPE tokenization for 100% accuracy. Claude, Gemini, and DeepSeek token counts use deterministic Provider-Calibrated UTF-8 Token Projections, and results are explicitly labeled as projected instead of exact. Image token calculations follow each provider's published visual-token rules including patch, tile, and detail capacity parameters. The tool will never generate a fabricated estimate for a model that does not have public documented image token rules.

Pricing data is refreshed from the Models.dev public registry, with an offline bundled fallback available for use when there is no network connection. All listed rates include separate line items for standard input tokens, discounted cached input tokens, and output tokens per million units.

Supported Workflows

Knowledge Base Ingestion Planning

Upload a text-based PDF, combine it with prompt instructions, and compare total payload context fit and input cost across all providers before processing the full document set for RAG systems.

Vision Request Budgeting

Combine an image with accompanying prompt text, then calculate the total token footprint and estimated cost for multimodal requests across all supported vision models.

Code Repository Review Estimation

Attach multiple code, configuration, and documentation files as a single workload to find models that have enough context window capacity to process the full codebase excerpt in one request.

Batch Data Processing Comparison

Combine structured CSV data with processing instructions to compare per-request cost across providers for recurring batch processing workloads, to select the lowest cost option that fits your throughput requirements.

Limitations

Scanned non-text PDFs are not supported and require external OCR to extract readable text before counting. The tool returns estimates for non-OpenAI text token counts and image token values, which may differ slightly from counts returned directly by provider APIs due to internal provider processing wrappers and hidden system tokens. Final billing from each LLM provider remains the authoritative source of actual costs.

Comments

Comments

No comments yet. Be the first to share your thoughts!