Count tokens for GPT, Claude, and Gemini prompts. Exact via tiktoken for OpenAI models, approximation for Claude/Gemini.
Used by GPT-4o, GPT-4o-mini, GPT-4-Turbo (2024+).
Format, validate, and minify JSON data with syntax highlighting
Encode and decode Base64 strings
Generate and validate UUIDs (v4)
Test regular expressions with real-time matching
Large language models read text as a sequence of "tokens" — chunks of one or several characters that map to a numeric vocabulary. OpenAI bills GPT-4 and GPT-3.5 per token, Anthropic bills Claude per token, and every model has a hard context-window limit (8K, 128K, 200K, 1M+ tokens). The Token Counter computes the exact token count for OpenAI models (using tiktoken-compatible BPE encoders running in your browser) and a chars-per-token approximation for Claude and Gemini, whose tokenizers Anthropic and Google have not published. Use it to verify a prompt fits the context window, predict API costs, or debug truncation issues — all without sending the text anywhere.
GPT-4 / GPT-3.5 (cl100k_base): ~3.5-4 chars/token GPT-4o (o200k_base): ~4-4.5 chars/token (better compression) Claude (estimate): ~3.5 chars/token Gemini (estimate): ~4 chars/token For CJK languages (中文、日本語、한국어), the ratio drops to ~1.5-2 chars/token because each glyph carries more semantic load.