# What a web page costs in tokens, measured on ten public pages

Raw HTML, markdown, readability and text output for the same ten pages, counted in o200k tokens. Markdown cut the bill 15x at the median, and readability took the five article pages from 25,902 tokens to 19,382.

Canonical: https://spider.cloud/blog/what-a-web-page-costs-in-tokens/

An agent that reads the web pays for every page twice. Once to fetch it, and again every time the page sits in the context window. The second bill is the one that grows, and it depends on which form of the page you kept. I wanted a number instead of a feeling, so I fetched ten public pages through our [scrape endpoint](/api/scrape/) in four output formats and counted the tokens.

I first ran this on 2026-11-05. The readability column in that run was bad enough that we replaced the article finder behind the flag, and I ran it again on 2026-11-06. The table is the second run. The readability section says what the first one found.

## The run

Ten pages, chosen for shape rather than fame: a Wikipedia article, four documentation pages (Python, MDN, Kubernetes, React), a GitHub repository page, two news front pages (BBC, the Guardian), the Hacker News front page and the gov.uk organisations index. Each one fetched four times with `return_format` set to `raw`, `markdown` and `text`, plus `markdown` with `readability: true`. Tokens counted with gpt-tokenizer 4.0.0 using the o200k_base encoding.

Two pages from the original list of twelve are out of the table. In the first run Stack Overflow answered with a 403, and the arXiv abstract came back as a 6.8 KB stub whose markdown was 38 bytes. I report both because a benchmark that hides its misses is an ad.

| Page                             | raw     | markdown | readability | text  |
| -------------------------------- | ------- | -------- | ----------- | ----- |
| en.wikipedia.org, Web scraping   | 60,870  | 13,491   | 11,205      | 6,411 |
| docs.python.org, asyncio         | 3,840   | 1,070    | 931         | 569   |
| developer.mozilla.org, HTTP 429  | 20,559  | 622      | 622         | 1,924 |
| kubernetes.io, concepts overview | 120,495 | 2,573    | 2,028       | 5,983 |
| react.dev, learn                 | 83,269  | 4,473    | 3,458       | 3,602 |
| github.com, spider-rs/spider     | 50,074  | 4,295    | 1,760       | 1,240 |
| bbc.com, news front page         | 103,231 | 5,406    | 5,406       | 1,768 |
| theguardian.com, international   | 435,624 | 21,154   | 21,154      | 4,137 |
| news.ycombinator.com             | 11,343  | 3,936    | 3,936       | 1,224 |
| gov.uk, organisations            | 118,109 | 29,394   | 29,394      | 6,197 |

Tokens per page, o200k_base, 2026-11-06. Totals across the ten: 1,007,414 raw, 86,414 markdown, 79,894 readability, 33,055 text.

## What the numbers say

Markdown cut the token count by 15x at the median, with a range of 2.9x on Hacker News to 47x on the Kubernetes page. The spread is the interesting part. Hacker News is already mostly text, so there is little to strip. The Kubernetes overview is a short chapter wrapped in a 480 KB shell of navigation, scripts and inline SVG, and almost all of it goes.

Text came in smaller than markdown on 8 of the 10 pages, 19.6x at the median. The difference is link targets and heading marks. That is exactly the material an agent uses to decide what to fetch next, so text is the right format when the page is the answer and the wrong one when the page is a step in a crawl. The two exceptions, MDN and Kubernetes, are pages where the markdown converter dropped boilerplate that the text path kept.

## Readability, before and after

The first run is why this section exists. On 2026-11-05 readability returned 3, 19, 21 and 59 tokens on four of these pages, each with a 200. A front page has no single body, the finder kept almost nothing, and nothing in the response said so. An agent with readability on would have read the BBC front page as one sentence and believed it. The same finder cut the Wikipedia article to 6,865 tokens by dropping whole sections, History and Legal issues among them. That is losing the article, which is a different thing from trimming the page around it.

We replaced the finder with a port of the one Safari Reader uses. We also changed what happens when it finds no article: the response is the markdown you get with readability off.

In the second run it found an article on five pages and trimmed every one of them. The Wikipedia article keeps every section and its references and loses the sidebar and navigation, 11,205 tokens against 13,491. The GitHub page keeps the README and drops the rest, 1,760 against 4,295. Across those five pages readability came to 19,382 tokens against 25,902 as markdown.

On the other five pages the readability column equals the markdown column. Four are index pages, where that is the right answer. The fifth is MDN’s page for HTTP 429, a short reference page the finder did not rate as an article. That one is a miss. It costs you the 622 tokens of plain markdown and nothing else.

## What to do with this

Set the format per page type, not per pipeline. Markdown is the default for anything an agent will navigate from. Text is for pages you are summarizing and discarding. Readability trims article pages and leaves the others alone, so it no longer needs a length check to catch an empty body. It also does nothing for an index page. If a front page is too big for your context, text is the format that shrinks it.

If you store raw HTML today, the median page in this run is 72,070 tokens raw against 4,384 as markdown. At any per-token price, that gap is the difference between a context window that holds one page and one that holds sixteen.

Reproduce it with your own URLs. The call for one format is a single request:

```bash
curl -s https://api.spider.cloud/scrape \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://kubernetes.io/docs/concepts/overview/", "return_format": "markdown", "readability": false}'
```

Swap `return_format` and `readability`, count the `content` field with the tokenizer your model uses, and compare against the raw fetch. For HTML you already hold, the [transform endpoint](/docs/api/transform/) converts it without fetching again. Start with one page you are paying for right now and see what it costs in each form.

## Frequently asked questions

### How many tokens is a typical web page?

In this run of ten public pages fetched on 2026-11-06, the raw HTML ran from 3,840 tokens for a Python docs page to 435,624 for the Guardian's international front page, counted with the o200k_base encoding. The same pages as markdown ran from 622 to 29,394 tokens.

### Does markdown or plain text use fewer tokens?

Text was smaller on 8 of the 10 pages in this run, because it drops link targets and heading marks. Markdown keeps the links and the structure, which an agent usually needs to decide what to fetch next. Pick text when the page is the final answer, markdown when it is a step.

### When should I turn on readability?

When the pages are articles. In this run readability found an article on five of the ten pages and cut their markdown from 25,902 tokens to 19,382. On the other five it found none and returned the same markdown you get with readability off. It will not shrink an index page such as a news front page or Hacker News.

### Which tokenizer was used?

gpt-tokenizer 4.0.0 with the o200k_base encoding, the one GPT-4o class models use. Other model families tokenize differently, so treat the ratios as the stable part and the absolute counts as approximate for your model.

## Sources

1. [Measured run, 2026-11-06: ten public pages, four output formats each, through the Spider scrape endpoint](https://spider.cloud/docs/api/scrape/)
2. [gpt-tokenizer (o200k_base encoding)](https://github.com/niieani/gpt-tokenizer)
3. [Safari Reader, whose article finder the readability flag follows](https://support.apple.com/guide/safari/hide-distractions-when-reading-sfri32632/mac)
4. [Spider transform endpoint, for HTML you already have](https://spider.cloud/docs/api/transform/)
