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
- 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
- Pick the tokenizer for your model: o200k_base for current OpenAI models, cl100k_base for GPT-4 and GPT-3.5.
- Paste your prompt, document or code. The token, word and character counts update as you type.
- Check the context window bars, and enter a price per million tokens to see the cost.
- 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:
| Text | Characters per token | Words per token |
|---|---|---|
| Plain English prose | About 4 to 4.5 characters | About 0.75 words |
| Source code | About 3.5 characters | About 0.4 words: symbols and indentation cost tokens |
| Numbers and IDs | 1 to 3 digits | Long numbers split into many tokens |
| Chinese, Japanese | About 1 to 1.5 characters | Words 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:
| Model | Where to get the count | Accuracy on this page |
|---|---|---|
| GPT-5, GPT-4.1, GPT-4o, o-series | This tool, o200k_base | Exact |
| GPT-4, GPT-3.5 | This tool, cl100k_base | Exact |
| Claude | Anthropic API token counting endpoint | Exact; estimate here |
| Gemini | Gemini API countTokens, or AI Studio | Exact; estimate here |
| Local models in Ollama | prompt_eval_count in each response | Exact; 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
- GuideBest Local LLM for 16GB RAM: 10 Models That Fit (2026)The best local LLMs for 16GB RAM and no GPU: 10 models that fit, real Ollama sizes, speed estimates, and the popular picks that only fit a 16GB GPU.
- GuideBest Local LLM for 32GB RAM: 10 Models That Fit (2026)The best local LLMs for 32GB RAM and no GPU: 10 models that fit, real Ollama sizes, and why mixture-of-experts models run 5 to 10 times faster on a CPU.
- GuideWhat Is Q4_K_M? GGUF Quantization Explained (2026)What Q4_K_M means in a GGUF file, how it compares with Q4_K_S, Q5_K_M, Q6_K, Q8_0, IQ4_XS and UD-Q4_K_XL, and which quantization to download for your RAM.
- GuideBest LLM for 8GB RAM, CPU Only: 9 Open Source Picks (2026)The best open source LLMs for 8GB RAM and no GPU: 9 models that fit, real download sizes, speed estimates and Ollama setup for Windows, Mac and Linux.
- LLM VRAM and RAM CalculatorFind how much VRAM or RAM a local LLM needs for any model size, GGUF quantization and context length, and whether it fits your GPU, Mac or PC.
More text and code tools
View all tools- QR Code GeneratorTurn any link or text into a QR code and download it as PNG or SVG. Static codes that never expire and carry no tracking. Free, private.
- Text to Hex ConverterConvert text to hex and back. See the UTF-8 bytes, Unicode code points and HTML entities of any character, emoji included. Free and private.
- Base64 Encode and DecodeEncode text to Base64 or decode Base64 to text, with UTF-8, emoji and URL-safe Base64URL support plus a Basic auth header builder. Free, private.
- Text to MD5 Hash GeneratorConvert text to an MD5 hash as you type. Hash a whole list at once, add a salt, or check text against an existing hash. Free, nothing is uploaded.
- Document TimestampProve a PDF or Word file existed on a date. Its SHA-256 hash is recorded in the public Sigstore Rekor log. Free, and the file never leaves your device.
- Bitcoin Timestamp (OpenTimestamps)Timestamp any file on the Bitcoin blockchain with OpenTimestamps, then verify or upgrade the .ots proof. Free, and your file never leaves your device.