boxtool.io

Token Counter

Count tokens and estimate API costs for GPT-4o, Claude, Gemini and more. Free, private, runs in your browser.

0

Characters

0

Words

0

Tokens

Model

Cost Estimate

Assumed output length25% of input (0 tokens)

Input (0 tokens)

$2.5/1M tokens

< $0.001

Output (~0 tokens)

$10/1M tokens

< $0.001

Total estimated cost

input + output

< $0.001
Context window usage0 / 128,000 (0%)

Token counts are estimates, not exact figures — this tool applies a per-family character-length heuristic rather than running each provider's real tokenizer, so ordinary prose lands close while code, URLs, emoji and non-Latin scripts can drift further. Use it for budgeting, not for billing reconciliation. Prices are list rates last checked in July 2026 and change often — check the provider's own pricing page before committing to a number.

About Token Counter

Language model APIs charge by the token — typically a unit roughly equivalent to four characters or three quarters of a word in English. Understanding token counts before submitting text to an API helps you estimate costs, ensure your input fits within a model's context window, and optimize prompts to reduce unnecessary length without losing effectiveness.

Our Token Counter estimates the token count for any text and prices it against twelve models, grouped under one tab per provider: GPT-4o, GPT-4o mini, GPT-4 Turbo, o1 and o1-mini from OpenAI; Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5 and Claude Haiku 4.5 from Anthropic; and Gemini 2.0 Pro, Gemini 2.0 Flash and Gemini 1.5 Pro from Google. Each carries its own input and output rate and its own context window, which range from 128K tokens up to 2M. The estimates update as you type, giving you a real-time view of how prompt engineering decisions affect cost.

Because providers bill input and output separately, the calculator does too. A slider sets how long you expect the reply to be, anywhere from 5% to 200% of your input, and the breakdown splits input cost, output cost and total so you can see which side of the exchange actually drives your bill. A progress bar shows how much of the selected model's context window your text occupies, turning amber past 70% and red past 90%, and a copy button lifts the whole summary out as plain text for a ticket or a spreadsheet.

Be clear about what the count is: this tool does not run each provider's real tokenizer. Those ship as multi-megabyte WebAssembly downloads and each one only covers a single family. Instead it applies a per-family character-length heuristic, tuned separately for GPT, Claude and Gemini. Ordinary English prose lands close to the real figure; code, URLs, emoji and non-Latin scripts drift further. Use it to budget and to check that a document fits in the window, not to reconcile an invoice — and treat the prices as list rates that change often. All processing runs locally: your text, prompts, or proprietary data never leaves your browser.

How to Use Token Counter

  1. 1Paste or type your text, prompt, or document into the input field.
  2. 2The token count and word count update in real time as you type.
  3. 3Pick the provider tab — OpenAI, Anthropic or Google — then the model, to price the text against that specific API.
  4. 4Drag the "Assumed output length" slider to match how long you expect the reply to be, from 5% to 200% of your input.
  5. 5Read the breakdown: input cost, output cost and total, each with the per-million rate it was calculated from.
  6. 6Watch the context window bar to see how much of the model's limit your text uses — it turns amber past 70% and red past 90%.
  7. 7Click Copy to lift the whole summary — characters, words, tokens, model, costs and context usage — out as plain text.
  8. 8Use the cost estimate to inform prompt optimization before running expensive production queries.

Use Cases

  • Estimate the API cost of a prompt template before running it at production scale
  • Check whether a large document fits within a model's context window before submitting it
  • Switch between GPT-4o, Claude and Gemini to see how the same text is priced by each provider
  • Optimize a system prompt to reduce token count without losing essential instructions
  • Audit input length in batch processing workflows to identify unexpectedly large inputs
  • Understand how formatting (markdown, code blocks, line breaks) affects token consumption

Tips

  • Token counts differ between models — GPT-4o and Claude tokenize the same text slightly differently
  • Code, URLs, and technical content often use more tokens per character than plain prose
  • Shorter, clearly structured prompts with less formatting use fewer tokens and cost less to run
  • System prompts count toward total token usage in most API implementations — include them in estimates
  • Markdown formatting (headers, bullet points, bold) adds tokens — weigh it against the clarity benefit
  • At scale, even small prompt optimizations compound: saving 50 tokens per call × 10,000 calls = 500k tokens
  • These are estimates from a length heuristic, not output from the providers' own tokenizers — budget with them, do not reconcile invoices with them
  • Output is usually billed several times higher than input, so the output-length slider moves the total more than the prompt does
  • The context window is shared by your prompt and the reply — a document at 95% of the limit leaves almost no room to answer
  • Context windows vary hugely between the models listed here, from 128K tokens up to 2M — check the figure under each model name
  • Prices are list rates that providers change often; verify on the official pricing page before committing a number to a plan
  • Batch and cached-input discounts are not modelled here, so a real bill can land below the estimate

Frequently Asked Questions

A token is the basic unit that language models use to process text. On average, 1 token ≈ 4 characters or ¾ of a word in English.

They are approximations, not exact counts. This tool does not run the providers' real tokenizers — those need a multi-megabyte WebAssembly download and only cover one provider each. Instead it applies a per-family character-length heuristic. For ordinary English prose it lands close to the real number; code, URLs, emoji and non-Latin scripts drift further. Use it for budgeting and context-window planning, not for reconciling an invoice.

Eleven, grouped by provider tab: GPT-4o, GPT-4o mini, GPT-4 Turbo, o1 and o1-mini from OpenAI; Claude Opus, Sonnet and Haiku from Anthropic; and Gemini 2.0 Pro, Gemini 2.0 Flash and Gemini 1.5 Pro from Google. Each carries its own context window and input/output pricing.

Cost = (input tokens / 1,000,000) × input price + (output tokens / 1,000,000) × output price. Input and output are billed separately by all major providers.

The context window is the maximum number of tokens a model can process in a single request. Once the context window is full, the model cannot process additional tokens.

Prices shown are sourced from official provider documentation. AI model pricing changes frequently — always verify current pricing on the official provider pages.

No. All token counting and cost calculation happens entirely in your browser. Your text is never sent to any server.

Related Tools

Ad