Home

Token counter

Count tokens for ChatGPT, Claude, Gemini, and Llama. Paste text, HTML, or a URL; we show counts across every major tokenizer and how many tokens you save by converting HTML to Markdown with mdream .

Tokenizer estimates below
Ready

Paste text, HTML, or a URL to count tokens.

How mdream reduces tokens

Every HTML page carries tag overhead that tokenizers charge you for. Converting to focused markdown before the LLM sees it keeps the context and drops the tax.

  1. 1

    Convert HTML to markdown

    mdream strips scripts, nav, footers, and inline styles. What remains is the content an LLM actually needs.

  2. 2

    Tokenize both sides

    We estimate cl100k_base, o200k_base, Llama 3, and Gemini counts so you can see the delta per model family.

  3. 3

    Compare and save

    Typical pages drop 50–80% of tokens after conversion. That's real money back on every LLM call.

Which tokenizer?

  • cl100k_base — official OpenAI BPE, exact. GPT-3.5, GPT-4, and a very close approximation for Claude 3 & 3.5. Use this if you're unsure which model you're targeting.
  • o200k_base — official OpenAI BPE, exact. GPT-4o and GPT-4o-mini. Roughly 8% fewer tokens than cl100k_base on English text.
  • llama3 — estimate. Meta Llama 3's tokenizer isn't open; we scale cl100k by +8% based on published vocab size.
  • gemini — estimate. Google hasn't released Gemini's SentencePiece; we use a char-frequency heuristic. Treat this column as a ballpark.

Frequently Asked Questions

GPT-4, GPT-3.5, and Claude 3+ counts come from OpenAI's official cl100k_base BPE vocabulary via gpt-tokenizer; GPT-4o counts use o200k_base. These are exact. Llama 3 and Gemini tokenizers are not publicly released, so those columns are heuristic estimates calibrated against published model documentation.

HTML carries tag overhead (class names, inline styles, script tags, nav menus, cookie banners). LLM tokenizers count every angle bracket, attribute, and piece of whitespace. Markdown strips all of that, keeping only the content an agent needs to answer a question.

No. Text, HTML, and URL inputs are tokenized in-flight on a Cloudflare Worker and discarded on response. Nothing is logged or persisted.

OpenAI's tokenizer only counts one tokenizer at a time and only accepts plain text. This tool also fetches URLs, runs mdream's HTML-to-markdown pipeline, and shows the token delta across four tokenizer families side by side.

Yes. Anthropic has stated Claude 3 and 3.5 use a tokenizer very close to OpenAI's cl100k_base. For most content, the cl100k_base column is within a few percent of Anthropic's official count.

Related