LLM workflows

HTML vs Markdown for LLMs: token counts on 11 real pages

Updated October 14, 2026 · 5 min read

Most numbers quoted for HTML vs Markdown for LLMs come from companies that sell the conversion, on pages they chose, without a method. We make a conversion tool too, so we ran the comparison on 11 public pages and publish what is needed to check us: the pages, the counts, and the cases where Markdown hardly helps. Short version: the saving ranges from 25% to 98%, and the median is 91%.

The results

Token counts for each page as HTML source, as visible text, and as Markdown. Measured on October 14, 2026.

Page HTML source Visible text Markdown Saved vs HTML
GitHub repository page (mixmark-io/turndown) 140,848 2,508 2,310 98.4%
Cloudflare blog, Introducing Markdown for Agents 111,653 3,874 2,279 98.0%
Wikipedia, Markdown 100,267 5,716 3,756 96.3%
react.dev, Thinking in React 96,653 4,916 5,491 94.3%
MDN, Array.prototype.map() 48,153 2,856 3,373 93.0%
web.dev, Web Vitals 34,999 3,145 3,032 91.3%
Substack post, Astral Codex Ten 114,392 11,374 14,338 87.5%
Hacker News, thread 8863 32,786 6,758 7,360 77.6%
Python docs, Coroutines and Tasks 50,059 9,410 14,051 71.9%
Simon Willison, Things we learned about LLMs in 2024 22,524 9,650 15,180 32.6%
Paul Graham, How to Do Great Work 19,184 13,570 14,294 25.5%

Six of the eleven pages lose more than 90% of their tokens when converted. Two lose less than a third.

How we measured

  • HTML source. Each address was fetched once with curl and a desktop Chrome user agent. The count covers the whole response: markup, inline scripts, inline styles.
  • Visible text. The text of the page body after removing script and style elements. Menus and footers are included, since they are visible.
  • Markdown. The output of the Markforge 1.0.0 parsers run on that HTML, with the YAML frontmatter and the title, exactly as the extension would save it.
  • Tokenizer. The gpt-tokenizer library, the same counter Markforge shows in its popup.

Three caveats. The source of a page is not the document your browser ends up with after scripts run, so a copy from the browser's inspector can be larger. Other model families tokenize differently, so read the absolute numbers as GPT tokens. And one page per site is a sample, not a survey.

Two rows need a footnote. On the GitHub page, the parser extracts the README and leaves the repository interface, which is the point of a README parser. On Wikipedia, the parser drops the infobox, the footnotes and the reference list, so its Markdown is smaller than the article's full text.

What the numbers say

The saving tracks the markup, not the content

The pages at the top of the table are not the longest. The GitHub page holds about 2,500 tokens of text inside 140,000 tokens of source. The page at the bottom, a Paul Graham essay, holds 13,500 tokens of text inside 19,000 tokens of hand-written HTML. Both are prose. The ratio of source to text is 56 to 1 on one side and 1.4 to 1 on the other.

Cloudflare gives a small example of where the weight comes from in its post on Markdown for Agents: a heading written ## About Us costs about 3 tokens, and the same heading as an h2 with a class and an id costs 12 to 15. Multiply by every element on a page built from components, then add the scripts.

"HTML tokens" is not one number

Cloudflare states that the same blog post "takes 16,180 tokens in HTML and 3,150 tokens when converted to markdown", an 80% reduction. Our count for the full source of that page is 111,653 tokens.

Both can be right. A pipeline that strips scripts and styles before counting starts from a much lower figure than someone pasting the page source. When you read a savings claim, check which HTML was counted. The saving you get in practice depends on what you would have pasted otherwise.

Markdown is not cheaper than plain text

Compare the last two columns. On seven pages out of eleven, Markdown costs more tokens than the visible text. On the Python documentation page it is 49% more.

The difference is mostly links. Markdown writes every link as text plus address, and addresses are expensive. What you get in exchange is structure: headings, lists, fenced code, and the ability to follow a reference.

When the addresses are useless to the model, drop them. Markforge has a Strip links toggle that keeps the link text and removes the URL. Measured on the same pages:

Page Markdown With links stripped Saved
Wikipedia, Markdown 3,756 2,301 38.7%
Simon Willison, LLMs in 2024 15,180 10,387 31.6%
Python docs, Coroutines and Tasks 14,051 11,002 21.7%
MDN, Array.prototype.map() 3,373 2,648 21.5%
react.dev, Thinking in React 5,491 5,376 2.1%
Hacker News, thread 8863 7,360 7,225 1.8%

When HTML is still the right input

  • The page is already lean. On hand-written HTML with few classes and no scripts, conversion saves a quarter of the tokens. If you have the HTML at hand, it is fine as it is.
  • You need the attributes. Writing a scraper, debugging a layout or auditing accessibility are questions about the markup itself.
  • The content is a table. Markforge 1.0.0 flattens tables to lines of text. For a page that is mostly a table, the HTML table carries the structure and our Markdown does not.

Try it on your own pages

Eleven pages do not describe yours. The fastest check is to open a page you paste often, convert it, and read the count.

Markforge shows the token count of the Markdown in its popup as soon as it opens, and updates it when you toggle Strip links or edit the content. The practical steps are in how to copy a web page as Markdown for an LLM.

Frequently asked questions

How many tokens does Markdown save compared to HTML?

It depends on how heavy the page's markup is. Across 11 public pages measured on October 14, 2026, Markdown used between 25% and 98% fewer tokens than the HTML source, with a median saving of 91%. Lean hand-written HTML gains little, application-style pages gain the most.

Is Markdown cheaper than plain text for an LLM?

Not necessarily. In our measurements Markdown cost between 0.6 and 1.6 times the tokens of the page's visible text. Markdown keeps headings, code fences and link URLs, and the URLs are what make it heavier on link-rich pages.

Why do published figures for the same page differ so much?

Because HTML can mean the article markup or the whole document with its scripts and styles. Cloudflare counts 16,180 HTML tokens for one of its blog posts. The full source of that page, as served on October 14, 2026, came to 111,653 tokens in our count.

How can I see the token count of a page before pasting it?

Markforge shows the token count of the converted Markdown in its popup, next to the character and word counts. It uses a GPT tokenizer, so the figure is exact for OpenAI models and an estimate for others.

Related guides