Skip to main content

Text to analyze

0 / 50000 Characters
Accuracy Disclaimer

This tool uses BPE/SentencePiece approximation algorithms. The actual count may differ by up to 10-15% from official tokenizers (tiktoken, HuggingFace). For exact counts use the library of your provider's API. Prices are snapshot as at May 2026 and can vary.

How it works

Paste the text

Any text: prompt, code, article, JSON. Up to 50,000 characters.

Instant estimate

BPE/SentencePiece regex algorithm with automatic IT/EN language detection and technical text.

Cost comparison

9 models sorted by cost. The self-hosted model (Ollama) costs $0 per token, but the server has a fixed cost. Hardcoded prices, snapshot 2026-05.

Come utilizzare Token Counter Multi-Model

Stick the text

Paste or type in text, prompt, or code to analyze in the input field (up to 50,000 characters).

Choose your cost method

Choose "Only Input" to estimate only the input cost, or "Input + Output" to include a preview of the expected output.

Read the comparative table

The table shows tokens, chars/token and USD cost for 9 LLM models, sorted by ascending total cost. The self-hosted model (for example Ollama) is shown at $0 per token: its real cost is the fixed cost of the server.

Suggerimenti

  • Activate "Input + Output" and stick to a typical model response to estimate the real end-to-end cost, not just the prompt.
  • Compare at least one cloud and one on-premises model: cost differences can be of orders of magnitude.
  • If you work with technical text or code, remember that the char/token ratio is typically lower than with natural prose: expect more tokens than you might think.

Domande frequenti

How accurate is the count of tokens?

The tool uses an approximation BPE/SentencePiece algorithm with automatic language detection (IT/EN) and technical text. Typical offset is 10-15% compared to official tokenizers (tiktoken for OpenAI, HuggingFace tokenizer for other models). Always use the official library of the provider before going into production for exact counting.

Why does the same text generate a different number of tokens for each model?

Every family of models uses a different tokenizer (BPE for GPT, SentencePiece for Llama/Mistral, proprietary encodings for Claude and Gemini) with distinct vocabularies and segmentation rules. This results in the same text producing different counts by up to 20-30% between models, especially on non-English text.

Are prices shown up-to-date?

Prices for tokens are a snapshot of May 2026 and are hardcoded in the tool. Providers update price lists periodically, so always check official provider pricing before making final budget estimates.

Why does a self-hosted model such as Ollama show $0 per token?

Models run locally (for example Ollama on your own server) have no per-token cost because they do not go through a paid API, but they are not free: the cost is the fixed cost of the server, which does not depend on the number of tokens. That is why the tool shows $0 per token for them and lists them at the top of the sort order.

Are my data being sent to a server?

No. Token counting and cost calculation occur entirely on the client-side in the browser: no API calls, no text sent to the server. You can use the tool with sensitive text or reserved prompts.

Want to learn more?

Read our in-depth articles on related topics: