Token Counter

Count tokens in text you paste, and see how many tokens you drop by converting HTML to Markdown. Free, no account. OpenAI encodings only — other models are estimates.

Claude, Gemini, Llama, and other non-OpenAI models use different tokenizers. Counts for those models are estimates only. Nothing on this page is a price per token.

Paste text to count tokens. Empty input stays at zero, and Clear stays disabled until there is something to remove.

Tokens
0
Characters
0
Words
0
Lines
0
Text mode counts in your browser. The text is not sent to WebInk.

What a token is

A token is a chunk of text a model reads. It is not a word, not a character, and not a line. English short words are often one token. Longer words, punctuation, numbers, and many emoji split into several. The counter above uses the byte-pair merge tables in gpt-tokenizer, loaded only after you need an encoding, so the first paint does not carry both vocabularies.

The four numbers in Text mode answer different questions. Tokens are the units a matching OpenAI model uses to measure prompt length. Characters are the string length in JavaScript, which counts UTF-16 code units: the globe emoji in 你好,世界 🌍 is one symbol and two characters, and that whole string is 5 tokens on o200k_base and 9 on cl100k_base. Words are runs of non-space text, so a Chinese sentence without spaces is one “word” here even though it is several tokens. Lines follow newline characters. Empty input is zero on all four, and Clear stays disabled until you type.

A familiar English sentence is a useful calibration. “The quick brown fox jumps over the lazy dog.” is 10 tokens on both encodings this page offers. If a rule of thumb told you “about four characters per token,” that sentence is close. Code, URLs, and CJK text are where the rule of thumb drifts, which is why the counter runs the real encoding instead of dividing the character count by four.

Why the same paste can count differently

OpenAI has shipped more than one vocabulary. o200k_base is the encoding labeled here for GPT-4o, GPT-4.1, and the o-series. cl100k_base is the encoding labeled for GPT-4 and GPT-3.5 Turbo. They agree on a lot of everyday English and disagree on other scripts. Pick the row that matches the model you will call. If the product you use is Claude, Gemini, Llama, or anything else, treat the number as an estimate and say so in your own notes. This page will not pretend one vocabulary covers every vendor.

Context length is a separate question from the encoding. A string can be 3,000 tokens and still be too long for a small window, or trivial inside a large one. The “context size to check” menu offers 8k, 32k, 128k, and 200k so you can see whether the current count fits a round limit you care about. Those options are not specifications of GPT-4o, Claude, or any other model. Model windows change, and this tool does not keep a price list or a model catalog.

The practical reason to care is prompt budget. Navigation, class names, inline styles, and scripts are tokens the model spends before it reaches the paragraph you meant. The HTML vs Markdown for LLMs guide explains that tradeoff with a labeled illustration. This counter is the place to measure a real fragment instead of trusting the illustration.

How to count tokens

1

Paste text, HTML, or a public URL

On Text, paste a prompt, an article, or model output. On HTML vs Markdown, either paste raw HTML or enter a public http(s) URL. Text and pasted HTML stay in the browser. A URL is fetched by WebInk’s server, which returns Markdown only.

2

Choose an encoding and a context size

Pick o200k_base (GPT-4o, GPT-4.1, o-series) or cl100k_base (GPT-4, GPT-3.5 Turbo). Optionally check the result against 8k, 32k, 128k, or 200k. Those four sizes are round limits you choose. They are not a claim about any model’s context window, and the page does not show a price per token.

3

Read the counts, then copy or send the Markdown

Text mode shows tokens, characters, words, and lines as you type. Paste HTML mode shows HTML tokens, Markdown tokens, tokens saved, and the percent change, with the converted Markdown underneath. From there you can copy, download a .md file, or send it to ChatGPT, Claude, Gemini, or Perplexity. URL mode shows the Markdown count only.

A measured HTML versus Markdown example

The sample behind “Try sample HTML” is a short article: a title, a paragraph with a link, a two-item list, a fenced shell snippet, a two-column table, and a script plus a style block that a reader never needs. Counted with o200k_base, the pasted HTML is 246 tokens. After the in-browser cleaner removes the script and style tags and Turndown rewrites the rest, the Markdown is 93 tokens. That is 153 tokens saved, 62.2% fewer. Click Try sample HTML to reproduce it. Those three figures are pinned by the project tests against this exact sample, not a rule of thumb.

Read the percent as a property of that fragment, not as a law. Switching to cl100k_base changes the integers. A docs page full of code fences will move less than a marketing page full of layout divs. A pipe table can grow. The comparison panel says when Markdown is larger, so you are not shown a saving that did not happen.

HTML tokens are the characters you pasted, including tags. Markdown tokens are the converted string, which is what Send to AI would hand to ChatGPT, Claude, Gemini, or Perplexity if you use the button under the preview. The same conversion is what the HTML to Markdown tool does on its own. If you only have a link, URL to Markdown fetches a public page. On this counter, that fetch can tell you the Markdown token count and cannot tell you the HTML side, because the API does not return the original markup. Paste the page HTML when the saving itself is the question.

Pasted text, pasted HTML, and Markdown fetched from a URL are cut at 2,000,000 characters, and a warning says only the first 2,000,000 were counted. The count waits on a deferred copy of the field so typing stays responsive while a large paste is tokenized. Malformed HTML is parsed with the browser’s DOMParser, the same repair a page would get if you opened it. If conversion still fails, the panel shows an English error instead of a partial percent.

Ways to spend fewer tokens

Convert the article to Markdown before you put it in a prompt. Tags, class names, and inline styles are real tokens and they rarely help the model answer a question about the writing. The sample above drops more than half its tokens by that step alone, mostly by losing the markup and the script, not by summarizing the sentences. A text-based PDF is the same idea: convert it with the PDF to Markdown tool, then paste the Markdown here if you need a count. That converter does not OCR a scan and does not upload the file. A .docx follows the same order: convert it with Word to Markdown first, then count the note here.

Paste the smallest fragment that contains the question. A full document source includes the header, the footer, and the cookie banner. In developer tools, copy the article element rather than the whole page. If the page is public and you do not want to hunt for that element, fetch it with URL mode or the URL tool, then count the Markdown. You still will not get an HTML baseline unless you paste the source yourself.

Delete boilerplate the extractor kept: share rows, related links, and author bios nested inside the article. Remove repeated examples if you only need one. Do not paste both the HTML and the Markdown into the same prompt unless the question is the difference between them. Sending both pays for the article twice. The send a webpage to ChatGPT guide covers the separate limit on how much of a prompt can ride in a chat URL. A count that fits 128k can still be too long for that link, and Send to AI falls back to copying when the URL would be too large.

Limits you should know before you trust a number

Text mode and Paste HTML mode do not upload the field. Public URL mode does call WebInk’s server, which fetches the URL with the same endpoint as the URL tool. That fetch sees a public page, not your cookies. A login wall comes back thin or empty. For a tab you are already signed into, convert with the extension and paste the Markdown here if you need the count.

The counter does not estimate dollars. Vendor rates change, output tokens are a different meter, and cached prefixes are outside this box. It also does not list official context windows. If a fit line says the text fits in 32k, it means the count is at or under the size you selected.

Special marker strings such as the end-of-text token are counted as tokens instead of aborting the count. That keeps a paste of model output from breaking the page. It is still the OpenAI encoding, not a Claude or Gemini bill.

Compared with OpenAI’s tokenizer and the extension

OpenAI publishes a tokenizer where you can see the colored splits for text you paste. Use it when you need to see which pieces a word broke into. Use this page when you need the HTML-versus-Markdown delta, or a Markdown count for a public URL. Pasted HTML is converted with the same in-browser cleaner as the HTML tool. A URL is converted by the public Markdown API, the same one the URL tool calls, and that response does not include the original HTML. This tool does not paint token highlights.

The WebInk extension is the path for the page on your screen. It extracts the article, converts it, and can send it on. It does not show tokens. The online counter is the path for text you can paste, and for public URLs when a Markdown count is enough. The two meet when you copy extension Markdown into the Text tab.

JobThis counterOpenAI tokenizerWebInk extension
Count pasted text with OpenAI encodingsYesYesNo
Show each token’s boundariesNoYesNo
Compare pasted HTML with MarkdownYesNoNo
Count Markdown from a public URLYesNoNo
Convert a logged-in tabNoNoYes

OpenAI’s tokenizer is on platform.openai.com/tokenizer. WebInk does not operate that page.

Add the WebInk extension

Frequently asked questions

It counts tokens with OpenAI byte-pair encodings, and it also reports characters, words, and lines. Characters are the JavaScript string length, so an emoji that uses two UTF-16 code units counts as two characters. Words are whitespace-separated. Lines are split on newline characters, and an empty box is zero for every stat. Tokens are not words: the sentence “The quick brown fox jumps over the lazy dog.” is 10 tokens on both o200k_base and cl100k_base.

Related