Skip to content
Kordu Tools Kordu Tools

AI Token Counter

Runs in browser

Count tokens for GPT-4o, Claude, Gemini, and more using real tiktoken BPE encoding with API cost estimates.

Last updated 01 Apr 2026

Paste any text to count tokens using the exact BPE encoding from OpenAI's tiktoken library. Supports GPT-4o, GPT-4.1, GPT-4, o1, o3, Claude 3.5/4, Gemini 1.5/2, and Llama 3 — with live cost estimates based on current API pricing. Shows context window usage percentage. Entirely browser-based, no data uploaded.

o200k_base

0

Tokens

0

Characters

0

Words

$0.00

Est. Input Cost

Cost Breakdown
Input$0.00

$2.50 / 1M tokens

Output$0.00

$10.00 / 1M tokens

Pricing based on publicly available API rates — verify with the provider before production use.

Loading rating…

How to use

  1. 1

    Select your AI model

    Choose the model you are targeting from the dropdown. Models are grouped by provider: OpenAI (GPT-4o, o1, o3, GPT-4.1), Anthropic (Claude 3.5, Claude 4), and Google (Gemini 1.5, Gemini 2.0).

  2. 2

    Paste or type your text

    Paste your prompt, document, or any text into the input area. Token count, word count, and character count update automatically as you type.

  3. 3

    Check context window usage

    The context bar shows what percentage of the selected model's context window your text uses — helpful for staying within limits on large documents.

  4. 4

    Review the cost estimate

    The cost panel shows estimated input and output API costs based on the model's current public pricing per million tokens.

Frequently asked questions

What is a token in AI models?
A token is a chunk of text — roughly 3–4 characters or about 0.75 words in English. Tokenizers like BPE (Byte Pair Encoding) split text into common subword units. 'hello' is one token, 'chatbot' might be two. Code and non-English text typically use more tokens per word than English prose.
Is this accurate for GPT-4o and GPT-4.1?
Yes. GPT-4o, GPT-4.1, and the o-series (o1, o3) use o200k_base encoding. GPT-4 and GPT-3.5-turbo use cl100k_base. This tool uses js-tiktoken with the same rank data, so counts match OpenAI's API exactly.
How accurate are Claude and Gemini token counts?
Approximate. Anthropic and Google use proprietary tokenizers that are not publicly available. This tool uses cl100k_base as a proxy — typically within 5–10% for English text. For precise billing figures, check your provider's usage dashboard.
Why does token count matter?
Two reasons: context limits and cost. Every model has a maximum context window — exceed it and the model truncates your input or returns an error. On paid APIs, you pay per token in and out. Knowing your count upfront lets you optimise prompts and control costs before sending.
What is the context window percentage?
It shows what fraction of the model's total context window your text occupies. For example, GPT-4o has a 128K token context window. If your text is 12,800 tokens, the bar shows 10%. This helps you see how much room remains for the model's response.
Is my text sent to a server?
No. All tokenization runs entirely in your browser using JavaScript. The BPE rank data (~2–4 MB depending on encoding) is downloaded once from a CDN and cached locally. Your text never leaves your device.
Why is the first count slightly slower?
The tokenizer's BPE rank data is downloaded the first time you use the tool (~2–4 MB). After that, it is cached in your browser and all subsequent counts are instant.
Does token count include system prompts?
This tool counts the tokens in whatever text you paste. If your use case includes a system prompt, you should paste the full combined text (system prompt + user message) to get an accurate total count.
Can I use this to estimate API costs?
Yes. The cost estimate panel shows estimated input and output costs for the selected model based on current public pricing. These are estimates — actual costs depend on your provider tier, batching, caching, and any discounts in your contract.

AI Token Counter tells you exactly how many tokens your text will consume before you

send it to an AI API. Token count determines context window usage and API cost — both

of which directly affect what you can build and what you pay.

The tool uses js-tiktoken, a JavaScript port of OpenAI's official tiktoken library,

with the same BPE rank data. GPT-4o, GPT-4.1, and the o-series models use

o200k_base encoding. GPT-4 and GPT-3.5-turbo use cl100k_base. Counts for these

models are exact — identical to what OpenAI's API charges you for.

For Anthropic (Claude 3.5 Sonnet, Claude 3 Opus, Claude 4) and Google (Gemini 1.5,

Gemini 2.0) models, cl100k_base is used as a close proxy. These providers use

proprietary tokenizers, so the estimate is typically within 5–10% for English text.

The stats bar shows token count, word count, character count, and what percentage of

the selected model's context window the text consumes. The cost panel breaks down

estimated input and output costs based on current public API pricing per million

tokens. The tokenizer loads lazily on first use and caches in memory — subsequent

counts are instant. All processing is client-side.

Related tools

Learn more