1. Home
  2. Developer tools
  3. LLM Token Counter

LLM Token Counter

Know how big a prompt or document is in tokens before sending it to a language model, and what a feature will cost at your volume.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use LLM Token Counter

  1. Paste a prompt or document.
  2. Choose the tokenizer and context window.
  3. Enter your provider’s prices to estimate cost.

Features

  • Exact counts for OpenAI’s o200k_base and cl100k_base encodings
  • Token boundaries highlighted
  • Characters per token and context-window meter
  • Cost per call, per day and per 30 days
  • Runs entirely in the browser

Supported formats

Input

  • Typed or pasted text

You get

  • Screen view

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the LLM Token Counter is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Counts are exact only for OpenAI models that use o200k_base or cl100k_base; other model families are approximate.
  • Prices are entered by you and are not looked up.

Guide

Counting tokens and estimating the cost of LLM prompts

Language models read and write text in tokens, and everything about using them is measured in tokens: how much fits in the context window, how long a response may be and what each call costs. Counting words or characters only approximates that. This counter runs the actual tokenizer used by OpenAI models on your text, shows where the token boundaries fall and turns the count into a cost estimate.

What a token is

Models do not see letters or words but pieces of text from a fixed vocabulary, built with byte-pair encoding: frequent sequences such as common words or word endings become single tokens, and rare words are split into several. “ shipping” with its leading space might be one token, while an unusual name breaks into three or four. Spaces, punctuation and line breaks belong to tokens too, which the highlighted view makes visible.

The two encodings

The counter implements the two byte-pair encodings OpenAI’s current models use. o200k_base, with a vocabulary of about 200,000 tokens, is used by GPT-4o and newer models. cl100k_base, with about 100,000, is used by GPT-4 and GPT-3.5 Turbo. The larger vocabulary usually needs fewer tokens for the same text, especially for code and non-English languages. For models that use these encodings, the count is exact.

Context windows

A model’s context window is the total number of tokens it can consider at once, including the system prompt, the conversation so far, any documents you include and the response it writes. Pick a window size to see how much of it the text fills; the meter turns red and a warning appears when the text is longer than the window, a sign to split the document, summarise parts of it or retrieve only relevant sections.

Estimating cost

API pricing is quoted per million tokens, with different prices for input (what you send) and output (what the model writes). Enter the prices from your provider’s pricing page, the number of tokens you expect in each response and how many calls you make per day. The estimate is (input tokens × input price + output tokens × output price) ÷ 1,000,000 per call, then per day and per 30 days. Prices change and providers offer discounts for cached input and batch requests, so no prices are built in.

A worked example

The Sample is a short support-assistant prompt with a customer message. It is 297 characters long and counts 70 tokens with o200k_base, about 4.2 characters per token. Switching to cl100k_base gives 73 tokens for the same text. With the default figures of 2.5 and 10 dollars per million input and output tokens and 500 expected output tokens, each call costs about half a cent, and 1,000 calls a day come to about $155 over 30 days.

Other model families

Claude, Gemini, Llama, Mistral and other model families each have their own tokenizer and vocabulary, so the same text gives different counts. The number here is a reasonable approximation for them, often within a modest margin for English, but use the provider’s own token-counting endpoint or library when exact numbers matter for billing or limits. Chat APIs also add a few tokens per message for role markers.

Privacy

The tokenizer runs in your browser; the text you paste is not sent to any AI provider or to this site. That makes it safe to measure confidential prompts and documents before deciding what to send.

Checked against the current version of the LLM Token Counter on .

Frequently asked questions

How many tokens is a page of text?

For English prose, a rough rule is about four characters or three quarters of a word per token, so a 500-word page is roughly 650 to 700 tokens. Code, tables, numbers and non-English text usually need more tokens per word, which is why measuring beats estimating.

Do images and files count as tokens too?

Yes, when models accept them, but they are converted differently: images are billed by size in tiles or patches, and PDFs and other files are often turned into text first. This counter only measures text you paste.

Why does the same text give different counts for different models?

Each model family has its own vocabulary. Newer tokenizers with larger vocabularies, such as o200k_base, usually need fewer tokens for the same text, especially for non-English languages and code.

Why does non-English text use more tokens?

Tokenizers are trained mostly on English, so English words are often single tokens while words in other scripts are split into several pieces. The same message in Hindi or Amharic can cost several times as many tokens.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.