Count the tokens in a prompt and see if it fits the context window

Paste a prompt, a document or a whole file and get the exact token count for OpenAI's encodings, a budget against any context window with room for the answer, a map of every token and chunks for retrieval.

  • Free, no sign-up
  • Runs in your browser: Nothing you paste or drop leaves your device.

Updated 18 October 2026

Encoding

o200k_base is used by GPT-5, GPT-4.1, GPT-4o and the o-series. cl100k_base is used by GPT-4 and GPT-3.5.

Your text

Drop files here or

Count

0tokens

Characters
0
Words
0
Lines
0
Characters per token
0

Context window

Fits, with 396,000 tokens to spare after the answer's room.

Look closer

Each block is one token. Point at one to see its number. Spaces show as dots.

The tokens of your text show here.

Building on an LLM?

I design and build the AI parts of products: prompts people can steer, answers that show their sources, and limits that never surprise anyone.

What a token is

Language models don't read letters or words. They read tokens: pieces of text from a fixed vocabulary, often a whole short word, sometimes part of a long one, a space plus a word, or a single punctuation mark. In English a token is about four characters, or three quarters of a word, but code, numbers and other languages split differently. That is why counting characters only gives a rough guess, and why this tool runs the real tokenizer.

The token map shows it plainly. Paste a sentence and every block is one token, with spaces shown as dots, so you can see where the model's view of your text breaks.

Which encoding to pick

OpenAI's models use two encodings, and both are exact here:

  • o200k_base: GPT-5, GPT-4.1, GPT-4o and the o-series (o1, o3, o4-mini). It has a 200,000 token vocabulary and is much more efficient for non-English text and code.
  • cl100k_base: GPT-4, GPT-4 Turbo, GPT-3.5 Turbo and the older embedding models.

Claude, Gemini and Llama use their own tokenizers, which aren't published for the browser. For those models the tool counts with o200k_base and labels the result as an estimate: a good guide to the size of a prompt, not an exact figure.

Will my prompt fit the context window?

A context window is the most tokens a model can handle in one request, and it has to hold your input and the model's answer together. Pick a model, set the room you want to keep for the answer, and the bar shows how much of the window your text takes and how much is left. If the text runs over, the tool tells you by how many tokens.

Leave real room for the answer. A summary needs a few hundred tokens, a long report or a block of code can need several thousand, and a request that fills the window leaves the model nothing to reply with.

Splitting a document into chunks

Retrieval pipelines, embeddings and long document workflows need text in pieces of a set size. Set the chunk size and the overlap in tokens, and the tool cuts the text exactly where the tokens fall, with each chunk sharing its overlap with the next so no sentence loses its context. Download the chunks as a zip of text files, or as one JSON file with each chunk's index, its first token and its text.

Private, and fast on long files

The tokenizer runs in a Web Worker inside your browser, so a whole book counts without freezing the page, and none of your text is ever uploaded. The encoding files load once, the first time you count, and your browser keeps them. I built this alongside other free tools for teams building with AI, like the invisible character remover for cleaning model output.

Questions people ask

  • About 1,300 to 1,400 tokens for ordinary English with o200k_base, since a token averages about three quarters of a word. Code, numbers and other languages differ, so paste your own text for the real count.
  • Yes. The tool runs OpenAI's own encodings: o200kbase for GPT-5, GPT-4.1, GPT-4o and the o-series, and cl100kbase for GPT-4 and GPT-3.5. A chat request adds a few tokens per message for formatting, so the API's total can be slightly higher than the text alone.
  • As an estimate. Their tokenizers aren't published for the browser, so the tool counts with o200k_base and marks the result as estimated. Use it to judge size and fit, and the vendor's own API for an exact count.
  • o200kbase has about 200,000 tokens in its vocabulary and is used by OpenAI's newer models. It needs fewer tokens for most text, especially code and languages other than English. cl100kbase has about 100,000 and is used by GPT-4 and GPT-3.5.
  • No. Counting happens in your browser. The only thing downloaded is the encoding file, the same for everyone, and nothing you paste leaves your device.
  • For retrieval, 300 to 800 tokens with 10 to 20 percent overlap is a common start: small enough to stay on one topic, large enough to keep its context. Test with your own questions and adjust.
  • Vendors change their limits, so the list is a starting point. Pick My own limit to type the number from your provider's documentation.

Need more than a free tool?

I design and build products around jobs like this one. Start with a free 30 minute call, then get one written scope and one fixed quote.

Book a free intro call