CrawlCheck

Guides · 2026-10-02 · By · 1 view

Text-to-HTML ratio: does it matter, and how to check it

Not a ranking factor, but on a large page under five percent text, crawlers and AI agents download CSS, scripts and state before a sentence, and pay for it in tokens. Two commands to measure it and the block to remove first.

Text-to-HTML ratio is the share of a page's decompressed HTML bytes that is visible text. Google has said it is not a ranking signal, but it still matters to crawlers and AI agents with byte and token budgets: on a page that is 3 percent text, 97 percent of what they read is inline CSS, scripts, JSON state and SVG. Judge it on large pages only (over about 50 KB decompressed). Under 5 percent is unusual, and the fix starts with the single largest block, which is usually far bigger than the next.

Check your own site free

About a minute. First scan free with your email, nothing installed.

Text-to-HTML ratio earned its bad reputation: Google has said it does not use the ratio as a ranking signal, and tools that turned it into a target percentage invented a rule. The measurement underneath is still useful, for a different reason. Every machine that reads a page pays for bytes, and AI agents pay for tokens. A page whose visible words are a few percent of its HTML makes every reader download a framework before it reaches a sentence.

Decompressed HTML of one homepage (illustrative split)inline CSS 31%inline JSON state 24%inline scripts 21%SVG 9%tags 11%visible text 4%One block is usually most of the page. Remove that one first.
Where the bytes of a large homepage typically go. Only the outlined sliver is text a reader, or a model quoting the page, can use.

What does the ratio measure? #

Take the HTML exactly as the server sends it, decompress it, and count the bytes. Then extract the text a person would see, excluding scripts, styles, templates and hidden elements, and count those bytes. The ratio is the second over the first. Use decompressed bytes: CSS and JSON compress very well, so compressed sizes flatter repetitive markup, and the decompressed size is what a parser walks and a tokenizer consumes.

Size and share have to be read together. A 6 KB page that is 3 percent text is a short page with a nav bar, and there is nothing to fix. A 400 KB page that is 3 percent text is carrying serialized application state, an inlined stylesheet and an icon set before its first paragraph.

Is there a good ratio? #

No target, only a floor. Under 5 percent on a large page is plainly unusual; a page at 6 percent is not healthy because it cleared the line, and on a small page the ratio means nothing. A large page that is mostly code turns up on 28.4% of scanned sites, which makes it one of the most common delivery problems we see.

What does a mostly-code page cost an AI agent? #

An agent that hands a model the raw HTML pays for every tag, attribute, script and style block; one that extracts the text first pays only for the words. At roughly four characters of English per token, here is what two homepages cost to read on the same day:

Homepage, 18 October 2026Read as HTMLRead as textText share
A national news site~111,600 tokens~3,100 tokens3%
crawlcheck.io~12,400 tokens~1,900 tokens15%

On the news homepage, 97 of every 100 tokens an agent read as HTML were markup, scripts and styles. Our own homepage is far smaller and still 85 percent markup. A model's context window is fixed, so a page that spends most of its tokens on wrapper either crowds out the content, gets truncated, or costs more per question, and an agent comparing ten sources pays that ten times. Answer engines that fetch at the moment a user asks often work under time and size limits too, so a page that front-loads its styles and state can be cut off before the text that answers the question.

If the words only appear after JavaScript runs, the problem is larger: a non-rendering agent pays the full HTML cost and still sees almost no text. That is covered in whether AI crawlers render JavaScript. Serving a markdown version on request gives agents that ask for it roughly the text cost; the markdown for agents guide shows how. It is a shorter road, not a replacement for a readable page.

How do I measure it myself? #

Two commands on the HTML the server sends, not the browser's live DOM, which includes text inserted by JavaScript that a non-rendering crawler never receives:

# Decompressed bytes the server sends
curl -s --compressed -o page.html https://example.com/
wc -c < page.html

# Bytes of visible text: drop script, style, noscript, template, svg, comments and tags
perl -0pe 's/<(script|style|noscript|template|svg)\b.*?<\/\1>//gis; s/<!--.*?-->//gs; s/<[^>]+>//g; s/\s+/ /g' page.html | wc -c

Divide the second number by the first for the ratio. Divide each by four for a rough token count as HTML and as text; other languages, code and long URLs tokenize differently, so treat it as a scale, not a bill. Run it on the homepage and on your heaviest template, which is often a product listing or a location page rather than the homepage.

Then find the biggest single blocks:

# The largest inline blocks, biggest first
perl -0ne 'while (/<(script|style|svg)\b.*?<\/\1>/gis) { printf "%8d  %s\n", length($&), $1 }' page.html | sort -rn | head

The first line is almost always far larger than the second: an inline stylesheet of several hundred kilobytes, a hydration script carrying every product in a category, or a mega-menu repeated in a mobile copy. Fixing that one block typically moves the ratio more than every other change combined.

What to remove first #

Largest blockWhere it usually comes fromFirst fix
inline <style>page builders and critical-CSS plugins that inline everythinginline only above-the-fold rules; move the rest to a cached file
inline JSON stateframework hydration data (the id="__NEXT_DATA__" script, Nuxt, Gatsby page data)trim the props the page does not render; paginate large lists
inline <script>tag managers, chat widgets, consent tools pasted into the headload from a file with defer; drop unused tags
SVG markupicon sets inlined on every pageone sprite file referenced by <use>, or image files
data URIsimages and fonts base64-encoded into CSS or HTMLserve as files so they cache and do not inflate the page
repeated markupmega-menus and footers with hundreds of linksshorten the menu; render rarely used parts on demand

Re-measure after each change, and re-measure through the CDN: a cached copy of the old page keeps serving the old ratio until it is purged. The caching guide covers how to confirm what crawlers actually receive after a change.

Measured on a site we run #

A tree-service homepage we operate measured 7.7 percent visible text before a payload pass, with seven render-blocking stylesheets and the page builder's inline bootstrap script in the head. Merging four adjacent per-section stylesheets into one cached file, deferring the script loader, moving an inline compatibility script to a file and removing an emoji script, together with about 450 words added to an on-page guide, took it to 10.3 percent. Most of the movement came from deleting bytes that were not content. The text is rarely too short; the wrapper is too large.

What the ratio does not say #

A high ratio does not mean the page is good, only that it is not mostly wrapper. A parked domain with 800 words of boilerplate has an excellent ratio, as shown in a parking page that defeats every thin-content check. A low ratio on a homepage that is mostly navigation and images is not a defect by itself. It is a delivery and cost measurement, not a quality one.

Share of scanned sites with each finding in this articlePage is mostly code28.4%Share of scanned sites with eachfinding in this articlePage is mostly code28.4%
Read live from the same counters the dataset page uses, at the moment this page was served. Bars are scaled to the largest value shown, not to 100%.

Share this finding:LinkedInXEmailFollow Emmanuel on LinkedIn

Questions this post answers

Is text-to-HTML ratio a Google ranking factor?

No. Google has said it does not use the ratio as a ranking signal. It is still a useful measure of how much of a page's transfer is content rather than code.

What is a good text-to-HTML ratio?

There is no target. Visible text under 5 percent on a large page is unusual enough to be worth fixing; on a small page the ratio means nothing.

Should the ratio use compressed or decompressed bytes?

Decompressed. CSS and JSON compress very well, so compressed sizes understate how much markup a parser or tokenizer has to process.

How do I estimate what my page costs an AI agent in tokens?

Count the decompressed bytes of the HTML and divide by about four for English text; do the same for the visible text alone. The gap is what an agent reading raw HTML pays for markup instead of words.

What usually makes a page mostly code?

Inlined stylesheets, framework hydration state, tag-manager and widget scripts in the head, inlined SVG icon sets and base64 data URIs. One of them is usually most of the page.

Does a high ratio mean the page is good?

No. A parked page full of boilerplate text can have a high ratio. The ratio measures delivery and reading cost, not quality.

Related findings

The main product

Found this on your own site? We fix it for $100.

Scan free to see where you stand. The fix is one site, every finding implemented and re-measured, with a sealed before and after.

Free browser extension

Check this on any site you open, without leaving the page.

CrawlCheck for Chrome grades every site you visit A–F and shows, from your own browser, what search engines and AI assistants are actually served. Free, no account.

Write for the library

Measured something yourself? Submit an article.

Send your finding, the data and the method. A person reads every submission and replies by email; accepted articles are published under your name with a link to your study. Free to submit. Articles are accepted on merit; no one can pay to have one published.

Submit an article

How it works · a reply within about a week

Spotted a mistake or a bug on this page? Report an error. Confirmed errors are fixed and logged on the corrections page.

Comments

Comments are read before they appear. Nothing is published automatically, and no account is needed. An AI agent with a published signing key can post without the queue: it signs the request and the signature is checked against its own domain (how). Those appear at once, marked verified.

Writing about this? Facts, live figures and marks — every number on that page is dated and traceable to a scan.

All guides · The dataset · How the dataset works