Skip to content
AI suite

LLM Token Counter

Paste text to see estimated token counts for Claude, GPT, and Gemini side by side. GPT tokens are counted exactly with the o200k_base tokenizer; Claude and Gemini do not publish their tokenizers, so those counts are approximations.

Everything runs locally in your browser — your text is never sent to any server.

Guide: How to use & features

  • Paste a prompt, document, or code into the text area and the counts update automatically.
  • The tokenizer dictionary used for the exact GPT count is loaded on first input (a loading note is shown).
  • The Claude and Gemini cards carry an "approx." badge — expect roughly ±10–20% deviation.
  • Character, word, and line counts are shown as well, so you can gauge overall text size.

Samples: Sample input & output

Short English sentence

Input

The quick brown fox jumps over the lazy dog.

Output

GPT: 10 tokens (exact) / Claude: ~11 tokens / Gemini: ~10 tokens

Short Japanese sentence

Input

吾輩は猫である。名前はまだ無い。

Output

GPT: 14 tokens (exact) / Claude: ~19 tokens / Gemini: ~12 tokens — CJK text tends to use more tokens than English

FAQ: FAQ

  • What is a token?

    A token is the smallest unit an LLM uses to process text. In English one token is roughly four characters (a word fragment); in CJK languages a single character can be one or more tokens. API pricing and context-window limits are both measured in tokens, so knowing the count ahead of time is useful.
  • Is the GPT count exact?

    Yes. The tool runs the o200k_base tokenizer — the one used by GPT-4o, GPT-4.1, and the o-series models — directly in your browser, so it matches the OpenAI API count. Note that the chat API adds a few extra tokens of message-structure overhead.
  • Why are the Claude and Gemini counts approximate?

    Anthropic has not published the tokenizer used by Claude 3 and later, and Google does not offer a client-side tokenizer either. This tool estimates their counts from the exact GPT count and the character mix, which can deviate from the real API count by roughly ±10–20%. Use the vendors’ count APIs when you need exact numbers.
  • Why does Japanese text produce more tokens than English?

    Tokenizer vocabularies are built primarily from English text, so common English words often map to a single token, while Japanese characters are frequently split into one or more tokens each. The same content in Japanese typically uses 1.5–2× more tokens.
  • Is my text sent anywhere?

    No. Everything, including loading the tokenizer dictionary, happens inside your browser. Your text never reaches a server, so it is safe to paste confidential documents or source code.

Use cases: Common use cases

  • Estimating prompt costs

    API pricing is token-based. Check how many tokens a long system prompt or RAG context consumes before shipping it, and estimate the cost.

  • Checking context-window limits

    Before passing a whole document or log file to an LLM, verify that it fits within the model’s context window (e.g. 200K tokens).

  • Comparing token efficiency across models

    The same text tokenizes differently per model. Compare Claude, GPT, and Gemini side by side to gauge which is more cost-efficient for your content.

  • Optimizing non-English prompts

    CJK text tends to use more tokens than English. Measure how much you save by rewriting or shortening a prompt.

Notes: Notes & limitations

  • Claude and Gemini counts are estimates

    Anthropic and Google do not publish their tokenizers, so those values are inferred from the exact GPT count and the character mix. They may deviate ±10–20% from the real API count — do not use them for billing.

  • Chat API overhead is not included

    The counts cover only the pasted text. Chat APIs add a few tokens of message-structure overhead, and system prompts and tool definitions consume tokens separately.

  • Tokenizers change between model generations

    The GPT count uses o200k_base (GPT-4o / GPT-4.1 / o-series). Older models such as GPT-3.5 and GPT-4 use cl100k_base and will differ. Vendors may also change tokenizers in the future.

  • Use the official count APIs for exact numbers

    Anthropic’s count_tokens API and Google’s countTokens API return the exact count for the actual model (this requires sending your text to them).

Characters: 0 Words: 0 Lines: 0

Claude

approx.

0

tokens

Estimate (Anthropic does not publish a tokenizer for Claude 3+)

GPT

exact

0

tokens

o200k_base — GPT-5.5 / GPT-5 / GPT-4o / GPT-4.1

Gemini

approx.

0

tokens

Estimate (Google does not publish a client-side tokenizer)

Per-model breakdown

Model Tokens Context limit Usage
Claude Opus 4.8 approx. 0 200K 0%
Claude Sonnet 4.5 approx. 0 200K 0%
Claude Haiku 4.5 approx. 0 200K 0%
GPT-5.5 0 1.05M 0%
GPT-5 0 400K 0%
GPT-4.1 0 1M 0%
GPT-4o 0 128K 0%
GPT-4 Turbo 0 128K 0%
GPT-3.5 Turbo 0 16K 0%
Gemini 3 Pro approx. 0 1M 0%
Gemini 2.5 Flash approx. 0 1M 0%

Claude and Gemini counts are heuristic estimates derived from the exact GPT count and the character mix, and may differ from the real API count by roughly ±10–20%. Use them for rough sizing, not billing.

Articles for this tool

Recent Articles

Use Case
2026-08-07

curl Options Cheat Sheet: What -X, -H and -d Actually Do

A reference for the curl options you meet in real API work: why -d already implies POST, how -d differs from --data-raw, the @ prefix that silently reads a file, single vs double quotes, and why -k and -L deserve more caution than they usually get.

Introduction
2026-08-06

Converting Between JSON Schema and Zod: How required Maps to .optional()

Inside a two-way converter that turns JSON Schema into a Zod schema and Zod code back into JSON Schema. Covers the inverted defaults between required and .optional(), the constraint mapping table, and how the Zod side is parsed without executing any code.

Use Case
2026-08-06

SQL Clause Order Reference: Why WHERE Can't See Your SELECT Alias

The order you write SQL clauses is not the order the database runs them. A reference for the logical execution order (FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT), why aliases fail in WHERE, when to use WHERE vs HAVING, and the MySQL/PostgreSQL differences that bite.

Use Case
2026-08-06

Unified Diff Format Reference: Reading @@ Hunks in git diff Output

How to read the unified diff format git produces: what the four numbers in @@ -12,7 +12,9 @@ mean, why a one-character edit shows as a whole-line replacement, the whitespace and line-ending traps, \ No newline at end of file, combined @@@ diffs on merges, and rename detection via similarity index.

Use Case
2026-08-06

UTC to JST Reference: The 9-Hour Offset, Cheat Sheet & Timezone Pitfalls

Convert between UTC and JST (Japan Standard Time) with a cheat sheet. Covers what Z and +09:00 mean in ISO 8601, when JavaScript date parsing silently shifts by 9 hours, MySQL/PostgreSQL timezone behavior, and why GitHub Actions cron always runs in UTC.

Use Case
2026-08-04

CREATE TABLE Reference: MySQL vs PostgreSQL vs SQLite Types & Constraints

A cross-database CREATE TABLE (DDL) reference with cheat sheets for data types, auto-increment keys (AUTO_INCREMENT / IDENTITY / rowid), foreign key ON DELETE behavior, and the CHECK constraint that MySQL silently ignores.

Ad

Ad