Counted in your browser. Your text is never uploaded.
The exact count uses the o200k_base tokenizer used by OpenAI's GPT-4o family and newer models. Other AI companies, such as Anthropic, Google and Meta, use their own tokenizers, so the same text can produce a different number of tokens. The estimate assumes about 4 characters per token, which is typical for English.
Share of context window
- 8K (8,192 tokens)0%
- 32K (32,768 tokens)0%
- 128K (128,000 tokens)0%
- 200K (200,000 tokens)0%
- 1M (1,000,000 tokens)0%
A model's context window has to hold your prompt and its reply, so leave room for the answer.
Key takeaways
- In English, one token is about 4 characters or three-quarters of a word, so 1,000 words is roughly 1,333 tokens.
- A 128K context window holds about 96,000 English words, or around 190 single-spaced pages.
- Counts are exact for OpenAI's o200k_base tokenizer; other companies' models split text differently.
- Code, non-English text and indented JSON usually use more tokens per character than plain prose.
How to use the AI Token Counter
- 1Type or paste your prompt, document or code into the text box, or press Try a sample. The tokenizer loads the first time you use the box.
- 2Read the exact token count for the GPT-4o tokenizer, along with the word and character counts.
- 3Check the Other models (estimate) figure if you are using a model from a different company.
- 4Look at the context window bars to see what share of an 8K, 32K, 128K, 200K or 1M token window your text would take.
- 5Use the colored token view to see exactly where the text is split.
What is a token?
AI language models do not read letters or whole words. They read tokens: chunks of text that may be a full word, part of a word, a punctuation mark or a space followed by a word. A tokenizer splits your text into these pieces and turns each one into a number.
Common English words are usually a single token, while long or unusual words are split into several. For example, "Tokenization is fascinating!" is 28 characters and 3 words, and the GPT-4o tokenizer splits it into 5 tokens: "Token", "ization", " is", " fascinating" and "!". The colored view in this tool shows the same split for your own text.
How tokenizers split text
Most modern models use a form of byte-pair encoding (BPE). The tokenizer starts from individual bytes and, during training, repeatedly merges the pairs that appear together most often, building a vocabulary of common pieces. o200k_base has a vocabulary of about 200,000 tokens, so frequent words, word endings and even common code patterns get a token of their own.
Because the merges are learned from data, frequent English words are cheap while rare words, names, typos and less common languages are split into more pieces. A leading space is usually part of the token, which is why " is" and "is" are different tokens, and why runs of spaces or line breaks can be grouped into a single token. Invisible characters pasted from chat windows also take tokens, and the AI text cleaner removes them.
Why token counts matter
Every model has a context window, which is the maximum number of tokens it can handle at once. That limit covers your instructions, any documents you paste, the conversation so far and the model's reply. If the total is too large, older text is cut off or the request fails.
Tokens are also the unit most AI services use for billing and for output limits. API usage is normally charged per token for both input and output, and a model may stop mid-answer when it reaches its maximum output length. To turn a token count into dollars, try the AI API cost calculator, which compares OpenAI, Claude and Gemini prices. Prices and limits change often, so check your provider's current figures. Running a model on your own GPU instead? The LLM VRAM calculator shows how much memory a long context takes.
Why counts differ between AI models
Each AI company trains its own tokenizer, so the same text can produce a different number of tokens in different models. The exact figure here uses o200k_base, the tokenizer used by OpenAI's GPT-4o family and newer models. Models from Anthropic, Google, Meta and others use different tokenizers, which is why the tool labels their figure as an estimate based on about 4 characters per token rather than claiming an exact count.
Useful rules of thumb for English are about 4 characters or 0.75 words per token, so 1,000 words is roughly 1,333 tokens and a 128,000 token window holds about 96,000 words. Other languages and code usually need more tokens for the same length: a short Japanese greeting of 13 characters takes 7 tokens. To compare against a word target instead, use the word counter.
Tips for shorter prompts
Remove filler such as long greetings, repeated instructions and boilerplate. When the source is a PDF, convert it to Markdown first to drop page numbers and broken line breaks. Paste only the relevant part of a document, and ask for a specific output length.
Typing the same long instructions into every chat? Write them once with the AI prompt generator, which puts the task, context and rules in short labelled sections with no padding, and shows a rough token count as you go.
Planning to publish a guide for AI assistants about your own site? A short file from the llms.txt generator stays well within any context window.
Structured data is often padded with whitespace. Minifying JSON with the JSON formatter removes indentation and line breaks, which can save a noticeable number of tokens. Unusual capitalization can also split words into extra pieces, so normalising text with the case converter sometimes helps.
For lists of records, going a step further pays off: the JSON to TOON converter rewrites the same data in TOON, which usually needs about a third fewer tokens than minified JSON.
Worked example
Counting a short prompt and a JSON payload
Paste the prompt "Summarize the following customer review in one sentence and list any product defects it mentions." into the box. It is 97 characters and 15 words, and the GPT-4o tokenizer counts 18 tokens. Almost every word is a single token, but "Summarize" is split into three pieces: "Summ", "ar" and "ize". The Other models figure shows about 25 tokens, because the 4-characters-per-token rule overestimates text made of common words.
Now paste a small JSON object, such as a user record with a name, an ID, a list of languages, a flag and a null field. Written on one line it is 82 characters and 28 tokens. Indented with 2 spaces, it grows to 116 characters and 47 tokens, about 68% more, even though the data is identical.
Multiply that difference across a large API response or a long document and the savings add up. Trimming whitespace and irrelevant fields before pasting is often the easiest way to stay inside a context window.
How much text fits in a context window
Approximate capacity for English prose, using 0.75 words per token and 500 words per single-spaced page, as explained in our guide on how many words fit on a page. The window must also hold the model's reply.
| Context window | Tokens | English words (approx.) | Single-spaced pages (approx.) |
|---|---|---|---|
| 8K | 8,192 | 6,000 | 12 |
| 32K | 32,768 | 25,000 | 49 |
| 128K | 128,000 | 96,000 | 192 |
| 200K | 200,000 | 150,000 | 300 |
| 1M | 1,000,000 | 750,000 | 1,500 |
Code, tables and languages such as Japanese, Chinese or Hindi typically fit much less text in the same window.
Frequently asked questions
Is this an exact count for ChatGPT?
It is exact for text encoded with o200k_base, the tokenizer behind OpenAI's GPT-4o family and newer models. Chat apps and APIs also add a few hidden tokens for message formatting and system instructions, so the total a service reports can be slightly higher than the count for your text alone.
Can I get exact counts for Claude, Gemini or Llama?
Not here. Those models use their own tokenizers, so an exact figure has to come from each provider's own token counting feature. The estimate shown is based on about 4 characters per token for English and is a reasonable guide for planning.
How many tokens are in 1,000 words?
For typical English prose, about 1,300 to 1,400 tokens, based on roughly 0.75 words per token. Code and non-English text usually need more.
Do spaces, punctuation and line breaks count as tokens?
Yes. Everything in the text is tokenized. Punctuation marks are usually their own tokens, a single space is normally attached to the following word, and runs of spaces or line breaks are often grouped into one or more whitespace tokens. Indentation therefore adds to the count, which the colored view makes easy to see.
Why do some tokens appear as strange symbols?
Some characters, such as emoji, accented letters and many non-Latin scripts, take several bytes and can be split across two or more tokens. A token holding only part of a character is shown as a placeholder symbol. The count itself is still correct.
Is my text sent anywhere?
No. The tokenizer is downloaded once and runs entirely in your browser, so your prompts, documents and code never leave your device. More private utilities are in the developer tools section.
Sources
- OpenAI Cookbook: How to count tokens with tiktoken
- Google AI for Developers: Understand and count tokens (Gemini API)
- Claude Platform Docs: Token counting
Last reviewed by the ToolsFiesta team.