ToolHub

AI Prompt Token Counter

Count the exact number of tokens in a prompt for OpenAI models (GPT-4o, GPT-4, GPT-3.5) before you call the API.

Tokens (estimate)
loading tokenizer…
Characters
Words
Tok / word

Counts are exact for OpenAI models (tiktoken). Claude and other providers use different tokenizers that aren't public, so treat their counts as a close approximation.

About AI Prompt Token Counter

Count the exact number of tokens in your prompt for OpenAI models before you send it, so you can stay within context limits and estimate cost. Runs entirely in your browser using the same tiktoken encodings OpenAI uses.

How to Use

  1. Paste or type your prompt.
  2. Pick the model / encoding (o200k for GPT-4o, cl100k for GPT-4 / GPT-3.5).
  3. See the live token count, plus characters and words.
  4. Trim your prompt to fit the context window or budget.

Why Use This Tool?

Frequently Asked Questions

What is a token?

A token is a chunk of text the model reads — roughly 4 characters or about ¾ of a word in English. Models are billed and context-limited by tokens, not words, so 1,000 words is usually around 1,300–1,500 tokens.

Is this accurate for GPT-4o and GPT-4?

Yes. It uses the real tiktoken encodings — o200k_base for GPT-4o / GPT-4.1 / o1 / o3, and cl100k_base for GPT-4, GPT-4 Turbo, and GPT-3.5 — so the count matches what OpenAI charges.

Does it work for Claude or Gemini?

Those providers use their own tokenizers, which aren't published, so this tool can't count them exactly. The number is a close approximation — expect it to be in the same ballpark.

Is my prompt sent anywhere?

No. Tokenisation happens entirely in your browser, so your prompt is never uploaded — safe for confidential or proprietary text.

Related tools