Skip to content
PickZeal
    Text and code tools

    AI Token Counter

    Count tokens exactly for GPT-5, GPT-4o and GPT-4, with estimates for Claude and Gemini, context window fit and cost. Free, nothing is uploaded.

    • Runs in your browser
    • Nothing is uploaded
    • Free, no sign-up
    Tokenizer

    Tokens
    0
    Words
    0
    Characters
    0
    Characters per token
    0

    Rule-of-thumb estimate for any model (characters / 4): 0 tokens

    Fits in a context window of

      Cost of this text as input: -

      Prices change often, so enter the current price from your provider's pricing page.

      How your text is split into tokens

      This free AI token counter shows exactly how many tokens your text uses in GPT-5, GPT-4.1, GPT-4o and GPT-4, and gives a close estimate for Claude, Gemini and local models. It also shows how your text splits into tokens, how much of a context window it fills and what it costs at the price you enter. The tokenizer runs in your browser, so nothing you paste is uploaded.

      How to count tokens online

      1. Pick the tokenizer for your model: o200k_base for current OpenAI models, cl100k_base for GPT-4 and GPT-3.5.
      2. Paste your prompt, document or code. The token, word and character counts update as you type.
      3. Check the context window bars, and enter a price per million tokens to see the cost.
      4. Scroll to the token view to see where each token starts and ends, or switch on token IDs.

      What is a token?

      Language models do not read letters or whole words. A tokenizer first cuts text into pieces called tokens: common words such as " the" are one token, longer or rarer words are split into parts such as "Token" and "ization", and punctuation usually gets its own token. Each piece maps to a number, the token ID, and the model only ever sees those numbers. Context limits, rate limits and API prices are all measured in tokens.

      OpenAI's tokenizers are published as tiktoken. This page uses gpt-tokenizer, a JavaScript port that gives the same token IDs.

      Tokens to words: the rule of thumb

      For English, OpenAI's guide puts one token at about four characters or three-quarters of a word, so 1,000 tokens is roughly 750 words. Google's Gemini docs give the same four characters per token and 60 to 80 words per 100 tokens. The ratio changes a lot with the kind of text:

      TextCharacters per tokenWords per token
      Plain English proseAbout 4 to 4.5 charactersAbout 0.75 words
      Source codeAbout 3.5 charactersAbout 0.4 words: symbols and indentation cost tokens
      Numbers and IDs1 to 3 digitsLong numbers split into many tokens
      Chinese, JapaneseAbout 1 to 1.5 charactersWords are not separated by spaces

      We measured these with the o200k_base tokenizer on sample text from this site. Paste your own text to get its real ratio, shown as Characters per token.

      Token counter for OpenAI, Claude and Gemini

      Every model family has its own tokenizer, so the same text gives a different count in each. Here is how to get an exact number for each one:

      ModelWhere to get the countAccuracy on this page
      GPT-5, GPT-4.1, GPT-4o, o-seriesThis tool, o200k_baseExact
      GPT-4, GPT-3.5This tool, cl100k_baseExact
      ClaudeAnthropic API token counting endpointExact; estimate here
      GeminiGemini API countTokens, or AI StudioExact; estimate here
      Local models in Ollamaprompt_eval_count in each responseExact; estimate here

      Anthropic's token counting endpoint is free to use and returns the count for a full Claude request, including system prompt and tools. Anthropic also notes that newer Claude models can tokenize the same text differently, so do not reuse counts measured on an older model. For Gemini, call countTokens in the Gemini API.

      How many tokens fit in a context window?

      The context window is the most text a model can handle in one request: your prompt, the conversation so far, any files, and the answer it writes. The bars above show how much of common window sizes your text fills, from 8K to 1M tokens. Leave room for the reply: a prompt that fills 95% of the window leaves the model almost no space to answer.

      Local models are tighter. Ollama and llama.cpp often run with a much smaller context than the model supports, and every extra token of context costs memory. Our LLM VRAM and RAM calculator shows how much memory a given context length needs.

      Count tokens for local LLMs in Ollama

      Llama, Qwen, Gemma and Mistral each ship their own tokenizer, so this page gives an estimate for them. The exact count is in Ollama's API output: each response from /api/generate and /api/chat includes prompt_eval_count, the tokens in your prompt, and eval_count, the tokens generated, as described in the Ollama API docs. New to running models yourself? Start with our guide on how to run an LLM locally.

      Your text stays private

      Counting happens on your device. The tokenizer file loads once from PickZeal, then your prompts, code and documents are processed locally and never sent anywhere. Need a plain word and character count instead? Use the Word Counter, or see all free in-browser tools.

      Frequently asked questions

      How do I count tokens in a prompt?

      Paste the prompt into the box and the token count appears as you type. Choose o200k_base for GPT-5, GPT-4.1, GPT-4o and the o-series, or cl100k_base for GPT-4 and GPT-3.5. The count is exact for those OpenAI models because it uses the same tokenizer they use.

      How many words is 1,000 tokens?

      About 750 English words. OpenAI's rule of thumb is that one token is about four characters, or three-quarters of a word, so 100 tokens is about 75 words. Google gives a similar range for Gemini: 100 tokens is about 60 to 80 English words. Code, numbers and most other languages use more tokens per word.

      Is there a Claude token counter?

      Claude uses its own tokenizer, which is not published as a file you can run in a browser, and it changes between model generations. For an exact count, Anthropic offers a free token counting endpoint in its API. For a quick estimate, the o200k_base count here or the four-characters rule is usually close for English text.

      How do I count Gemini tokens?

      Gemini uses its own tokenizer. The exact count comes from the countTokens method in the Gemini API, and AI Studio shows it as you type. For planning, Google says a Gemini token is about four characters, so the rule-of-thumb estimate on this page is a good guide.

      Why do spaces, emoji and other languages use more tokens?

      Tokenizers are built from common chunks of English text, so a frequent English word is often one token, including the space before it. Rare words, emoji, accented letters and scripts such as Chinese, Hindi or Arabic are split into smaller pieces, sometimes several tokens per character. The token view on this page shows exactly where each split happens.

      What is the difference between o200k_base and cl100k_base?

      They are two versions of OpenAI's tokenizer. cl100k_base has about 100,000 tokens and was used by GPT-4 and GPT-3.5. o200k_base has about 200,000 tokens and is used by GPT-4o, GPT-4.1, GPT-5 and the o-series. The larger vocabulary usually needs fewer tokens for the same text, especially outside English.

      Does a chat message use more tokens than its text?

      Yes, a little. Chat APIs wrap each message with a few formatting tokens for the role and message boundaries, and system prompts, tool definitions and images add more. Count your text here, then allow a small margin. The API response reports the exact usage for every request.

      How do I count tokens for a local model in Ollama?

      Ollama reports it for you. Every response from its generate and chat API includes prompt_eval_count, the number of tokens in your prompt, and eval_count, the number of tokens it wrote. Llama, Qwen and Gemma models use their own tokenizers, so treat the counts on this page as an estimate for them.

      Is my text uploaded?

      No. The tokenizer runs in your browser, so your prompts, documents and code are counted on your own device and never sent to PickZeal, OpenAI or anyone else.

      Topic

      More on Local LLMs

      See the full Local LLMs guide

      More text and code tools

      View all tools