Free · no account · nothing uploaded

Token counter and context window calculator

Paste a prompt, a document or an entire conversation and see the token count, what it costs to send across common models, and how much of each context window it consumes.

Workspace/tokens
RUNS LOCALLY

Token counter

Say it the way you would say it to a person. Your words are matched to one of 18 tools by readable rules, and the tool runs right here in your browser. No upload, no account.

/ tools⌘K search↑ last message

Token counterRuns on this device · nothing uploaded

This tool runs in your browser and needs JavaScript turned on.

How to use the token counter

  1. Paste your prompt or document into the message box, or drop a text, Markdown, CSV, JSON or HTML file into “Your files”.
  2. Ask in plain words — “how many tokens is it?” or “will this fit in GPT-4?” — or type /tokens.
  3. Read the token count, with the characters and words behind it and what it costs to send as input to each model.
  4. Check the context-window bars to see which models it fits and how full each window would be.

Things you can type: how many tokens is it will this fit in gpt-4?

Why token counts matter more than word counts

A language model does not read words. It reads tokens — sub-word fragments produced by a byte-pair encoding — and every limit that constrains your work is expressed in them: the context window, the price per call, the truncation point where your carefully assembled sources silently fall off the end.

Character counts and word counts are poor proxies. Code, JSON, URLs, non-English text and long identifiers all tokenize far more expensively than prose, sometimes at three times the rate. If you are budgeting a retrieval pipeline or debugging why a prompt got cut off, an estimate that is 30% wrong is not useful.

What this tool shows you

Paste or drop text and you get, immediately and locally:

  • The token count, plus characters, words and the characters-per-token ratio your text actually achieves.
  • Estimated input cost across a set of common model prices, so a long prompt can be compared before you send it.
  • A context-window fill bar per model — the fastest way to see that a 180k-token dossier will not fit where you were about to put it.

It tells you when it is guessing

The count comes from o200k_base, the byte-pair encoding GPT-4o and GPT-4.1 use. It is loaded from this site the first time you run the tool, and the count is exact for those models. Claude, Llama and Gemini each use their own tokenizer, so their true counts differ somewhat; treat the figure as a close guide for them.

If the tokenizer cannot be fetched — you are offline, or opening the page from a file — the tool falls back to a heuristic and says on screen that the number is an estimate.

That labelling is deliberate. A silently wrong token count is worse than an admitted approximation, because it is the kind of error you only discover after a pipeline has been built on top of it.

Where it fits in a research workflow

Token budgeting is the first constraint you hit when you stop chatting and start building context. It decides how many chunks you can retrieve, how much of a source you can quote, and whether a long report can be produced in one pass or has to be assembled.

FlexContext exists for that problem at the other end of the scale: keeping a growing library of documents, pages, transcripts and datasets, and choosing precisely which parts of it a model sees for a given question.

Questions

Token counter: common questions

Is this token counter free?

Yes — free, with no account and no sign-up. It runs entirely in your browser tab; your text is never uploaded anywhere.

Which models does it price?

It prices a set of commonly used models and shows the context-window fill for each. The numbers are list prices for input tokens, so treat them as a planning figure rather than an invoice.

How accurate is the token count?

Exact for GPT-4o and GPT-4.1, which use the o200k_base tokenizer this tool runs. Other model families tokenize differently, so for them it is a close guide rather than an exact figure. If the tokenizer cannot load, the tool falls back to a heuristic and labels the result an estimate on screen.

Can I count tokens in a file?

Yes. Drop a text, Markdown, CSV, JSON or HTML file anywhere on the page and it opens in the right tool with its contents loaded.