LLM Token Counter
Count the tokens in any text or prompt for GPT-5, GPT-4, Llama, Claude, and Gemini. Exact tokenisation for OpenAI and Llama models, runs entirely in your browser, nothing is uploaded.
Exact count for GPT-5 / GPT-4o using the o200k_base tokenizer.
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 larger than they need to be. Paste any prompt, choose a model, and you get the token count alongside word, character, sentence, and line statistics.
For OpenAI and Llama models the count is exact, computed with the same Byte Pair Encoding tokenizers those models use (o200k_base for GPT-5 and GPT-4o, cl100k_base for GPT-4 and GPT-3.5, and the Llama 3 tokenizer for Llama 3 and 4). For Claude and Gemini the tool shows a clearly labelled estimate, because those tokenizers are not openly available to run client-side. Everything happens locally in your browser, so your text is never uploaded.
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 summarise or chunk long inputs. It is especially important for retrieval-augmented generation and agentic loops, where appended context can quietly push a request over the limit.
Tokens vs words vs characters
Tokens do not map cleanly to words. Common words are often a single token, while rare words, code, emoji, and non-English text can split into several tokens each. As a rough guide, English text averages about four characters or three-quarters of a word per token, but the only reliable number is an actual tokenizer count, which is what this tool provides for OpenAI and Llama models.
Exact vs estimated counts
OpenAI and Meta publish their tokenizers, so GPT and Llama counts here are exact. Anthropic and Google do not ship browser-runnable tokenizers, so their counts are approximated from text length and marked as estimates. Use the estimate to plan, but treat the exact numbers as authoritative when you need a precise budget.
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 tool ➜LLM VRAM Calculator
Calculate the VRAM needed to run or fine-tune any LLM at any quantization.
Use tool ➜Text Encoding Converter
Convert between Text, Base64, Binary, Hexadecimal, and Decimal formats.
Use tool ➜JSON Formatter
Validate, format, and minify JSON data with syntax highlighting.
Use tool ➜