> ## Documentation Index
> Fetch the complete documentation index at: https://docs.37audits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Text to HTML Ratio

> Measures how much of the HTML a page serves is visible text, so search engines find content rather than markup.

<Info>
  **SEO Auditor** — fetches the audited page, measures the visible text against the full HTML and judges the ratio: more than 20% is healthy, 10–20% warns, 10% or less fails.
</Info>

<CardGroup cols={2}>
  <Card title="Content first" icon="file-lines">
    A page that is mostly markup gives search engines little to index and rank; a lean page puts its copy forward.
  </Card>

  <Card title="Lighter pages" icon="feather">
    Inline scripts, styles and wrapper markup are downloaded by every visitor but carry no message.
  </Card>
</CardGroup>

The text to HTML ratio compares the characters of visible text on a page with the characters of HTML it took to deliver them. Search engines index the text, not the markup, so a page where code outweighs copy gives them less to rank the page on, and every visitor downloads that code before reading anything. This auditor measures the ratio of the audited URL from the server's HTML (what a crawler receives on the first request) and compares it with the 10% and 20% thresholds that SEO tools commonly use.

## How it works

1. **Fetch** — sends a `GET` to the audited URL as 37AuditsBot. A blocked request ends the audit with `590`; any other failure (timeout, DNS, TLS, non-2xx answer) ends it with `500`.
2. **Parse** — parses the HTML with jsoup and reads the normalized text of `<body>` (the whole document when there is no body). Scripts, styles, comments, `<noscript>` and `<template>` content are markup, not text.
3. **Measure** — counts the characters of that text and the characters of the raw HTML; the ratio is text divided by HTML (an empty document counts as 0%).
4. **Rules** — a ratio of 10% or less fails (`400`); a ratio above 10% but not above 20% warns (`300`).
5. **Aggregate** — FAIL wins over WARNING; a ratio above 20% is `SUCCESS` (`200`). Every check carries `htmlLength`, `textLength`, `ratio` (4 decimals), `healthyThreshold` (0.20) and `moderateThreshold` (0.10) in its data.

## What it audits

Every row maps to one `checkRule*` method and one `CheckCode`, in the order the auditor runs them. CheckCode suffixes use status ranges: `200` success, `300–399` warning, `400–499` fail, `500–599` error.

| CheckCode | Status | When it fires | Recommendation | Why it matters |
| - | - | - | - | - |
| <a id="37A-TextToHTMLRatioAuditor-400" />`37A-TextToHTMLRatioAuditor-400` | `FAIL` | The visible text is 10% of the HTML length or less. | Raise the text to HTML ratio of `{url}` from `{ratio}` to more than 20.0%: move inline scripts and styles to external files, remove unused markup and wrapper elements, and add real page copy (the page has `{textLength}` characters of text in `{htmlLength}` characters of HTML). | A page that is almost all markup gives search engines little content to index and rank, and the extra code slows every download, so the page competes poorly in search results. |
| <a id="37A-TextToHTMLRatioAuditor-300" />`37A-TextToHTMLRatioAuditor-300` | `WARNING` | The visible text is above 10% but not above 20% of the HTML length. | Raise the text to HTML ratio of `{url}` from `{ratio}` to more than 20.0%: move inline scripts and styles to external files and trim wrapper markup around the `{textLength}` characters of text the page serves in `{htmlLength}` characters of HTML. | When markup outweighs the copy, search engines see less content to rank the page on and visitors download code that carries no message, so the page loses ground to leaner competitors. |
| <a id="37A-TextToHTMLRatioAuditor-200" />`37A-TextToHTMLRatioAuditor-200` | `SUCCESS` | All rules passed. Message is `Visible text on {url} is {textLength} of {htmlLength} HTML characters ({ratio}), above the 20.0% target.` | — | — |
| <a id="37A-TextToHTMLRatioAuditor-500" />`37A-TextToHTMLRatioAuditor-500` | `ERROR` | The page could not be fetched (timeout, DNS, TLS, or a non-2xx answer other than a block). | Make sure `{url}` answers with HTTP 2xx and an HTML body, then run the audit again. Last error: `{error}`. | — |
| <a id="37A-TextToHTMLRatioAuditor-590" />`37A-TextToHTMLRatioAuditor-590` | `ERROR` | The audited page answered HTTP 403, HTTP 429 or a Cloudflare challenge, so 37AuditsBot was blocked before it could read the page. | Allow 37AuditsBot in your firewall or bot protection: allowlist its user agent, or verify its Web Bot Auth signature. See [https://www.37audits.com/bot](https://www.37audits.com/bot). | While 37AuditsBot is blocked this audit cannot look at the site, so problems on it go unreported. |

## Output documentation

| Status | Description | Test logic |
| - | - | - |
| **SUCCESS** | The page serves a healthy share of visible text | Ratio above 20% (`200`). |
| **WARNING** | Markup outweighs the text | Ratio above 10% but not above 20% (`300`). |
| **FAIL** | The page is almost all markup | Ratio of 10% or less, including an empty document (`400`). |
| **ERROR** | The auditor could not read the page | Fetch failure or non-2xx answer (`500`); site blocked 37AuditsBot (`590`). |

## Risks and considerations

### What the ratio does and does not say

* There is no ratio that search engines require; the 10% and 20% thresholds are the ranges SEO tools commonly use. A low ratio is a signal to look at the page weight and the amount of real copy, not a penalty in itself.
* Pages that are legitimately light on text (a login form, a search page, a photo gallery, an application shell) will score low. Judge them by what the page is for.

### Server-rendered HTML only

* The auditor reads the HTML the server sends, not the page after JavaScript runs. A single-page application that renders its content in the browser serves almost no text in the HTML and fails, which is also what a crawler that does not execute JavaScript sees. Server-side rendering or pre-rendering fixes both.
* Text inside `<noscript>`, HTML comments and `<template>` elements is not counted as visible text.

### How the text is measured

* The visible text is the normalized text of `<body>` as jsoup reads it: whitespace is collapsed, and scripts, styles and comments are excluded. Earlier versions of this auditor stripped tags with regular expressions, which counted comments and `<noscript>` content as text; the verdict thresholds are unchanged.
* Lengths are counted in characters, not bytes, and the ratio is reported with four decimals in the check data.

### What this auditor does not check

* Only the audited URL is measured; other pages of the site may differ widely.
* The quality or relevance of the text is not judged, only its share of the HTML.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.