Back

LLM Token Counter

Count the tokens in any text or prompt. The General count works for any chat AI, or pick GPT, Claude, Gemini or Llama for a closer number. It runs entirely in your browser, and nothing is uploaded.

Tokenizer model

Not sure, or your model isn't listed? Keep General.

OpenAI

Anthropic

Google

Meta

Or drop a text file here, up to 1 MB. It isn't uploaded.

…tokens

Loading the o200k_base tokenizer in your browser…

Counts cover the text only. Chat formatting, system prompts, tools and images add more tokens to a real request.

17
Words
88
Characters
72
Characters (no spaces)
2
Sentences
1
Lines
…
Tokens / word

How to use this tool

  1. Paste or type your text

    Type a prompt, paste an API request body, or drop in any text you plan to send to a language model. The count updates as you type, so there's no submit button.

  2. Choose the target model

    Keep General if you're not sure or your model isn't listed. It gives a ballpark that suits any chat AI. Pick a GPT, Gemini or Llama 3 option for an exact text count, or Claude, GPT-6 or Llama 4 for a labeled estimate. Verify production counts with the provider's API.

  3. Read the token count

    The tool returns the token count alongside word, character, sentence, and line counts so you can compare all the metrics at once. Use the token number to check against the model's context window or price per million tokens.

  4. Trim the prompt if needed

    If the count exceeds your budget or context window, edit the text in place and the count drops live. Common wins include dropping redundant instructions, merging examples, or summarizing prior messages that no longer need full context.

About this tool

The LLM Token Counter tells you how many tokens a piece of text will use before you send it to a model.

Tokens are the units language models actually bill and budget by, so knowing the count up front helps you stay inside context windows, control API costs, and trim prompts that are longer than they need to be.

Paste any prompt, choose a model, and you get the token count alongside word, character, sentence, and line statistics.

Not sure which model to pick? The General count works for any chat AI. The GPT, Gemini and Llama 3 options run each model's own tokenizer locally. Claude, GPT-6 and Llama 4 are labeled estimates, since their tokenizers aren't public or can't ship in a browser. Text counts exclude chat templates, system formatting, and multimodal inputs. Check provider usage for billing.

Why token count matters

Every model has a context window measured in tokens, and most APIs bill per input and output token.

Counting tokens before a request lets you confirm a prompt fits, predict cost, and decide whether to summarize or chunk long inputs.

It matters most for retrieval-augmented generation and agentic loops, where appended context can quietly push a request over the limit.

Tokens vs words vs characters

Tokens can be words, word fragments, punctuation, or byte sequences. The selected tokenizer determines the count. This tool loads the OpenAI, Gemini and Llama 3 tokenizers for text counts, while Claude, GPT-6 and Llama 4 are estimated.

Exact vs estimated counts

The exact label means the selected text tokenizer loaded successfully, not that the number equals a full API bill. Chat templates and other inputs add tokens. Claude, GPT-6, Llama 4 and tokenizer-load fallbacks show estimates. Use provider usage or the model tokenizer for production verification.

Popular token guides

Practical explainers on tokenization, context windows, and cost optimization for LLM applications.

Guides that use this tool

Longer walkthroughs that put this tool next to the others a reader needs.

Frequently asked questions

What is a token in an LLM?
A token is a chunk of text that a language model reads as a single unit. It's usually a common word, part of a longer word, or a piece of punctuation rather than a whole word or a single character. As a rough rule of thumb, one token is about four characters of English text, and 100 tokens is roughly 75 words.
How accurate is this token counter?
Options marked Exact run the model's own tokenizer in your browser: OpenAI's o200k_base and cl100k_base, the Gemma tokenizers Google's SDK uses for Gemini, and the Llama 3 tokenizer. They match those tokenizers on plain text, without chat-template and API overhead. Claude, GPT-6 and Llama 4 don't have a tokenizer that can ship here, so they show labeled estimates based on the GPT-5 count, with no fixed accuracy guarantee. The default General count uses o200k_base as a ballpark for any model.
Why do different models report different token counts?
Each model family is trained with its own tokenizer and vocabulary, so the same sentence can split into a different number of tokens depending on the model. Newer vocabularies like OpenAI's o200k_base are generally more efficient, packing more characters into each token, which lowers the count compared to older tokenizers.
Is my text sent to a server?
No. Tokenization and counting run locally in your browser, and the tool doesn't upload the text. Your text also stays out of the page URL, so it doesn't land in browser history. Share and Save links carry only the model unless you choose to include the text.

Use this tool on your own site

Drop the Token Counter into your blog, docs, or CMS with one iframe snippet. Free, no signup. See all embeddable tools