agentic402

HTML vs Markdown tokens: 12 real web pages measured

Published 3 December 2026 · Updated 3 December 2026

HTML vs Markdown tokens, measured on 12 real pages on 3 December 2026: after cleanup and conversion, the median page was 96% smaller as Markdown than as raw HTML. Savings ranged from 71% (the Python json docs) to 99.3% (Linear's pricing page). Across all 12 pages, about 1.84 million estimated tokens of HTML became about 105,000 of Markdown.

Tokens here are estimates at 4 characters per token. The raw data is free to download as CSV and JSON.

The results

Each row is one page, fetched once. "Raw HTML" is the page as the server sent it. "Markdown" is the main content after the cleanup and conversion that our URL to Markdown tool uses.

Estimated tokens per page (characters ÷ 4), raw HTML vs Markdown. Measured 3 December 2026.
PageRaw HTMLMarkdownSaved
stripe.com/pricing231,9826,51297.2%
vercel.com/pricing315,8404,21498.7%
github.com/pricing235,3335,18297.8%
notion.com/pricing103,8455,82294.4%
slack.com/pricing178,68016,33290.9%
linear.app/pricing207,9321,45499.3%
MDN: HTTP 40252,4991,06298.0%
Python docs: json29,0368,47570.8%
Wikipedia: Large language model276,55347,10883.0%
bbc.com/news94,7262,57897.3%
blog.cloudflare.com54,3262,64095.1%
react.dev/learn61,3623,66094.0%

The median of the 12 savings is 96.2%. The mean is 93.0%, pulled down by the two prose-heavy pages. Counting all pages together, the Markdown was 94.3% smaller than the HTML. The median page was about 141,000 estimated tokens of HTML (taking the median of the HTML column) and about 4,700 of Markdown (the median of the Markdown column).

Why we ran it, and our interest in the answer

agentic402 sells fetch, a tool that converts pages to Markdown for $0.005 a call, so we have an obvious interest in the result coming out large. That's the reason for publishing every page, the method and the raw character counts rather than a single headline number. The 12 pages cover several kinds of page an agent reads (pricing pages, reference docs, an encyclopedia article, news and blog front pages). It is a small sample, not a random one, so treat it as an illustration of the pattern, and note that the two pages that saved least are in the table with the rest.

If you find an error in the data or the arithmetic, email abuse@agentic402.dev and we'll correct this post and note the change.

What kind of page saves the most

The pages fall into rough groups, and the groups behave differently.

Pricing and marketing pages save the most. The six pricing pages (Stripe, Vercel, GitHub, Notion, Slack, Linear) saved between 90.9% and 99.3%, and together went from about 1.27 million estimated tokens to about 40,000, a 96.9% cut. Linear's page was 143 times bigger as HTML than as Markdown. These pages are built with JavaScript frameworks and carry large amounts of script, styling and embedded data around a few thousand words of text.

Reference and documentation pages vary. MDN's page on the 402 status code saved 98.0%: it's a short article inside a large site shell. The Python json module docs saved only 70.8%, the lowest in the set. That page is mostly prose and code examples in plain HTML, so there's little to remove.

The encyclopedia article, Wikipedia's "Large language model", saved 83.0%. It's long (16,520 words of Markdown), so even after conversion it is the biggest Markdown file in the set at about 47,000 estimated tokens. Here the bigger saving comes from reading less of it, not from converting it.

News and blog front pages (BBC News, the Cloudflare blog) saved 97.3% and 95.1%. They're lists of headlines and teasers wrapped in heavy page furniture.

How we measured

We ran the 12 URLs through a small Cloudflare Worker on 3 December 2026, one request each. For every page it:

  1. Fetched the URL with the user agent agentic402-fetch/1.0 and Accept: text/html, following redirects, and recorded the length of the HTML.
  2. Removed the same elements that agentic402's fetch removes: script, style, noscript, svg, iframe, nav, header, footer, aside, form, template, button, images, video and audio, elements with navigation, banner or contentinfo roles, elements marked aria-hidden="true", and in-page anchor links. Remaining links were made absolute.
  3. Converted the cleaned HTML to Markdown with Cloudflare Workers AI's toMarkdown, removed empty links, and recorded the length and word count of the Markdown.

Lengths are JavaScript string lengths, which count characters (UTF-16 code units), not bytes. Estimated tokens are those lengths divided by 4. All 12 requests returned status 200.

This is the same cleanup and conversion as the live fetch tool, but not every step of it. The study didn't check robots.txt, didn't ask for Markdown first with an Accept: text/markdown header, and didn't use the browser fallback that fetch uses for pages that come back nearly empty. None of the 12 pages would have needed that fallback: the smallest Markdown result, MDN's, had 364 words, and fetch only switches to a browser below 50.

What it means in money

Token counts become costs at your model's input price. Take an illustrative $3 per million input tokens (not a quote for any model. Use your own rate). Reading all 12 pages once as raw HTML, about 1.84 million estimated tokens, would cost about $5.53. Reading them as Markdown, about 105,000 tokens, would cost about $0.32. Converting them with fetch costs $0.005 a page, $0.06 for the set.

The gap grows with every re-read. A page that stays in an agent's conversation is sent again with each later message, so a raw HTML page left in context for ten turns costs roughly ten times its single-read price without prompt caching (cached re-reads are billed at a reduced rate), where a Markdown page costs ten times a much smaller number.

Characters per word in the Markdown

The study also counted words in each Markdown result, which lets you convert between words, characters and estimated tokens. Across all 12 pages, the Markdown came to 420,150 characters and 41,862 words, about 10 characters per word including spaces and Markdown syntax. The median page was about 8.6 characters per word. Pages full of links and tables run higher, because URLs and table pipes add characters without adding words.

What the 4-characters-per-token estimate means

We didn't run a tokenizer. Characters divided by four is a common rule of thumb, and it's the same ratio implied by Anthropic's documentation for its web fetch tool, which estimates an "Average webpage (10 kB): ~2,500 tokens". But real tokenizers differ by model, and they split markup and prose differently. HTML attribute soup, long class names and base64 blobs can tokenize at a different rate from English sentences.

So read the token columns as a scale, not as exact counts for any model. The percentages are more reliable than the absolute numbers, since both sides of each comparison use the same estimate, but even they could shift if HTML and Markdown tokenize at different characters per token. If you need exact figures for one model, the CSV has the raw character counts to run your own tokenizer against the same pages.

What the comparison leaves out

The Markdown isn't the same content as the HTML minus the tags. The cleanup also removes navigation, headers, footers, sidebars and forms, which hold real text: menu labels, footer links, cookie notices. For an agent reading the page for its main content, that's the point. But it means this is a measure of "raw page vs cleaned main content", not "the same text in two formats".

It also compares against raw HTML, which is what an agent gets from curl or a plain HTTP request. Many agent tools already extract text from pages before a model reads them. If your agent's tool does that, your saving from converting to Markdown is smaller than these numbers.

And it's one fetch per page on one day. Pages change, A/B tests serve different HTML, and some sites send different markup to different user agents. Twelve pages is enough to show the pattern, not to give a precise average for the web.

How these numbers compare with other claims

Other published comparisons give very different ratios, and the differences come mostly from what each one counts:

Published HTML vs Markdown comparisons, as read on 3 December 2026
SourceClaimWhat was compared
A Skool community post"HTML is over 2x costlier than markdown"One report written in both formats. No tokenizer or pages named
OpenAI developer forum"Intensely formatted markdown => minimized HTML: 309 to 546"One demonstration document
Microlink"about 80% fewer tokens than raw HTML"Its Markdown product page, with one example (an excerpt of a blog post) of 326 vs 2.1k tokens
This studyMedian 96.2% fewer estimated tokens12 named live pages, raw HTML vs cleaned main content

The forum and Skool figures compare the same text written in two formats, so they measure only the cost of tags: roughly 1.8 to 2 times. Our study compares a whole live page with its cleaned main content, so it also counts scripts, styles, embedded data and page furniture that never make it into the Markdown. Microlink's example is an excerpt of one blog post, which sits closer to the first kind. Both kinds of number are right for what they measure. For an agent deciding whether to fetch a page raw or converted, the second kind is the relevant one.

What this means if you build agents

Raw HTML is an expensive way to read the web. On the pages most agents visit for facts, such as pricing, product and news pages, nearly all of the HTML is markup the model pays to read and then ignores. Converting to Markdown before the page reaches the model cut those pages by 90% to 99% in this sample.

Documentation written in plain HTML gains less, and long articles stay long. For those, read less: an outline, then the section you need. Our guide to reducing Claude Code token usage on web pages turns these results into concrete habits, and the llms.txt guide covers sites that already publish Markdown so no conversion is needed.

What we'd measure next

Three things would make the numbers sharper. Counting with real tokenizers for two or three common models would replace the 4-characters estimate with exact counts and show whether HTML and Markdown tokenize at different rates. A larger sample, a few hundred pages across page types, would give averages worth quoting on their own. And repeating the same 12 pages over a few months would show how stable the savings are as sites change. When we run any of these, the results will go in a new dated post, with this one left as it is.

Reproducing the study

The measurement is a single Cloudflare Worker of about 25 lines with a Workers AI binding. It loops over the URLs, runs the three steps above and returns one JSON object per page with the URL, status, HTML length, Markdown length and word count. To rerun it, deploy a Worker with an AI binding, paste in the same element list and conversion call, and request it once. Results will differ by date, because the pages change.

To check our arithmetic without rerunning anything, download the data. Each row has the character counts, the word count of the Markdown, both token estimates and the percentage saved, with the date. The JSON file also states the method and the units of the size and saving columns.

The data is free to reuse under the Creative Commons Attribution 4.0 licence: credit agentic402 and link to this page.

Questions about HTML and Markdown token counts

How many tokens is a typical web page as HTML?
In this sample, the median page was about 141,000 estimated tokens of raw HTML, at 4 characters per token. The range was about 29,000 (Python docs) to about 316,000 (Vercel's pricing page).
Is Markdown always smaller than HTML?
For the same content, yes, because Markdown has no closing tags or attributes. How much smaller depends on how much of the page was markup: 71% to 99% in this sample.
Why not count tokens with a real tokenizer?
Tokenizers differ by model, and the point was the scale of the difference, not one model's exact count. The raw character counts are published so anyone can run a specific tokenizer.

Cite this page: agentic402, "HTML vs Markdown tokens: 12 real web pages measured", https://agentic402.dev/blog/html-vs-markdown-token-study/, published 3 December 2026. Data: https://agentic402.dev/blog/html-vs-markdown-token-study/data.csv (CC BY 4.0).