InstantTools.org

Text & Writing

Token Counter (AI/LLM)

Accurately count tokens for OpenAI, Anthropic, and other LLMs before sending prompts.

Processing Mode

100% client-side via plain JavaScript text analysis running directly in this tab — nothing you type or paste leaves your device.

Privacy & Speed

Zero latency from uploads. Nothing you drop or paste here is sent to a server.

Local Hardware

Text parsing and scoring run instantly in your browser's JavaScript engine — no server round-trip per keystroke.


Token Counter (AI/LLM)

Accurately estimate token counts for GPT-4, Claude, and other large language models before sending your prompts.

What it does

The Token Counter analyzes any block of text and reports the estimated token count used by popular LLM APIs. It also shows approximate cost per request for OpenAI and Anthropic models so you can budget API usage before submitting. Token count, word count, and readability are three different measurements of the same text — see Readability Formulas Explained for how the other two are actually calculated.

How to use

  1. Open Token Counter from the Text & Writing category.
  2. Paste or type your prompt into the editor.
  3. View real-time token estimates, word counts, and per-model cost breakdowns instantly.

Why it matters

LLM APIs charge by token. Exceeding context-window limits can silently truncate your prompt, causing inaccurate responses. Checking your token count before sending helps you:

  • GPT-4o supports 128 K tokens; Claude Opus supports 200 K.
  • Trim unnecessary text from your prompt to reduce API spend.
  • If a response is cut short, compare your input tokens to the model's max context.

Supported models

| Model | Approx. cost / 1K tokens | | :------------ | :----------------------- | | GPT-4o | $0.005 | | Claude Opus | $0.015 | | GPT-3.5 Turbo | $0.001 |

Token estimates use the ~4 characters/token heuristic common across English text. For precise BPE tokenization, use the model provider's official tokenizer.

Common use cases

  • Ensure your system prompt + user query fits the context window.
  • Estimate monthly API costs for batch workflows.
  • Identify which sections to cut to stay under budget.

FAQ

How accurate is the estimate?

The counter uses a 4-character-per-token approximation that is reliable for English prose. Actual counts may vary by ±10 % for code or multilingual text.

Does it work for non-English text?

Yes, though non-Latin scripts typically produce more tokens per word. The estimate will still give a useful ballpark.

Is my text sent to any server?

No. All counting runs entirely in your browser — no data leaves your device.

Privacy

Token counting is performed 100 % client-side. No text is transmitted, stored, or logged on any server.

Access Related Text & Writing

Explore Other Toolkits