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
Or drop a text file here, up to 1 MB. It isn't uploaded.
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.
How to use this tool
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.
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.
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.
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?
How accurate is this token counter?
Why do different models report different token counts?
Is my text sent to a server?
Related tools
LLM API Pricing Calculator
Compare API costs across major models (OpenAI, Anthropic, Google) with prompt caching.
Use toolLLM VRAM Calculator
Calculate the VRAM needed to run or fine-tune any LLM at any quantization.
Use toolText Encoding Converter
Convert text to Base64, binary, hex, URL encoding and HTML entities, and back again.
Use toolJSON Formatter
Validate, format, and minify JSON. Browse it as a tree, run JSONPath queries, compare two documents, or validate against a JSON Schema.
Use toolUse 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