Skip to main content
AI Tools

AI Token Counter

Estimate token counts for GPT-4, GPT-4o, Claude, Gemini and Llama from any text. Counts are heuristic estimates within ±10-15% — accurate enough for planning, never logged.

No upload — your files never leave your device

  • 100% private
  • Runs in your browser
  • Works offline
  • No sign-up
118 chars·18 words·118 bytes

Per-model estimates

Heuristic counts — see each model's accuracy band. Real billing uses the provider's tokenizer.

  • GPT-4 / GPT-3.5

    cl100k_base · accuracy ±10%

    Used by ChatGPT, GPT-4, GPT-3.5. Standard OpenAI tokenizer through 2024.

    32

    tokens (estimate)

    in: $0.00008

    out: $0.00032

  • GPT-4o / GPT-4o-mini

    o200k_base · accuracy ±10%

    Newer OpenAI tokenizer — more efficient on multilingual text and code.

    29

    tokens (estimate)

    in: $0.00007

    out: $0.00029

  • Claude (Anthropic)

    claude-bpe · accuracy ±15%

    Anthropic uses a proprietary tokenizer; estimate only. Real counts via API.

    35

    tokens (estimate)

    in: $0.00011

    out: $0.00053

  • Gemini (Google)

    sentencepiece · accuracy ±15%

    Google uses SentencePiece. Estimate based on observed average ratios.

    32

    tokens (estimate)

    in: $0.00005

    out: $0.00019

  • Llama 3 / Mistral

    llama-bpe · accuracy ±15%

    Open-weight models. Tokenizers vary by checkpoint; treat as a rough range.

    34

    tokens (estimate)

    — open-weight

  • Generic (chars / 4)

    naïve · accuracy rough

    Simplest possible heuristic. Useful as a sanity-check baseline.

    32

    tokens (estimate)

    — open-weight

About these estimates

  • Counts are approximate — within ±10% for English prose, wider for code-heavy or non-Latin text.
  • No tokenizer is bundled — the page uses calibrated chars/word heuristics so it stays under 1KB of logic.
  • For exact billing, run your prompt through the provider's API and check the response usage metadata.
  • Pricing shown is rough public 2026Q1 input/output rates for the flagship tier of each closed model.

About AI Token Counter

Token counts drive LLM API pricing, context-window limits, and the quality of long-prompt completions. Knowing roughly how many tokens your prompt costs is useful before you hit Send. The AI Token Counter estimates token counts for the major model families — GPT-4 (cl100k), GPT-4o (o200k), Claude, Gemini and Llama — using length and word-shape heuristics calibrated against each tokenizer. Counts are estimates within roughly ±10-15% for English; non-English text and code-heavy prompts have wider error bands, which the page surfaces. No real tokenizer is bundled — that would add 150-250 KB for a tool that's meant to be a quick sanity check, not a billing engine.

  • No uploads
  • Browser-only
  • Works offline
  • 100% free

How it works

  1. 1

    Paste your text

    Anything from a one-line system prompt to a multi-page document. The counter updates as you type.

  2. 2

    Compare across models

    Each model card shows its estimate, the encoding family it uses, and the accuracy band. Pricing is shown for closed-weight models.

  3. 3

    Use for planning

    If you're approaching a context-window limit, use the count to chunk your prompt or trim. For exact billing, run through the provider's API.

Frequently asked questions about AI Token Counter

  • How accurate is the estimate?

    For English prose, within ~10% of the real tokenizer. For code-heavy or punctuation-heavy text, ~15%. For non-Latin scripts (Chinese, Arabic, Hindi) the accuracy drops because BPE tokenizers fragment those scripts at very different rates depending on the encoding. The page applies a non-ASCII penalty to compensate but it's still approximate.

  • Why not bundle a real tokenizer?

    gpt-tokenizer and js-tiktoken are 150-250 KB each. For a tool that exists to estimate counts, that's a steep tax. The heuristic gets within ±10% for the common case at 0 KB extra.

  • What's the difference between cl100k_base and o200k_base?

    cl100k_base is OpenAI's tokenizer through GPT-4 / GPT-3.5 Turbo. o200k_base is the newer encoding used by GPT-4o and GPT-4o-mini — it's more efficient for non-English text and code, so o200k counts tend to be 5-15% lower than cl100k for the same input.

  • Are the prices accurate?

    They're based on public 2026Q1 pricing for input/output tokens of the flagship tier. Actual cost depends on the specific model, tier and region. Use the figures as relative estimates, not invoices.

Privacy, offline use, browser support, and pricing questions are answered on the site-wide FAQ.

See all ai