What this calculator does
The text-to-HTML ratio compares the size of a page's visible text against its total size, including the HTML markup, CSS, JavaScript and any other code delivered with it. A page that is mostly code and very little text has a low ratio; a page that is mostly readable content has a high one.
This was once treated as a more direct ranking factor than it is today, but it remains a genuine technical-SEO diagnostic: a very low ratio can point to bloated markup, excessive scripts, or a thin amount of actual content relative to the page's overall weight, all of which are worth knowing about independently of any effect on rankings.
The formula
Divide the size of the visible text by the total size of the page, then express that as a percentage.
| Term | Meaning |
|---|---|
| Text-to-HTML ratio | Visible text size as a percentage of total page size: (text ÷ total) × 100. |
| Visible text size | The size, in kilobytes, of the text a visitor actually reads on the page. |
| Total page size | The combined size of the HTML, CSS, JavaScript and text delivered for the page. |
The inputs explained
| Field | What to enter |
|---|---|
| Visible text size (KB) | The size of the visible text content, in kilobytes, which most page-analysis tools can report directly. |
| Total page size (HTML, CSS, JS, text) (KB) | The total size of the page as delivered, including all markup, styling and scripts. |
When to use it
Diagnosing a heavy page
A page that feels sparse but weighs a lot often has a very low text-to-HTML ratio, pointing toward markup or script bloat rather than the visible content itself.
Comparing templates
Running two page templates with similar content through the same check shows which one carries more overhead per unit of actual text.
Tracking the effect of a cleanup
Recomputing the ratio before and after removing unused scripts or simplifying markup shows whether that work meaningfully changed the balance of text to code.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How the ratio changes as total page size grows at a fixed text size
A fixed 8 KB of visible text, against a range of total page sizes.
| Total page size | Text-to-HTML ratio | Markup, scripts and styling |
|---|---|---|
| 20 KB | 40.0% | 12.00 KB |
| 40 KB | 20.0% | 32.00 KB |
| 80 KB | 10.0% | 72.00 KB |
| 120 KB | 6.67% | 112.00 KB |
| 200 KB | 4.00% | 192.00 KB |
| 400 KB | 2.00% | 392.00 KB |
Questions
What counts as "visible text" for this calculation?
The readable body content a visitor sees on the page, not hidden text, alt attributes, or comments embedded in the markup.
Is there an ideal text-to-HTML ratio?
No fixed target is confirmed by search engines. It is more useful as a comparative check across your own pages, or before and after a technical change, than as a number to hit for its own sake.
Does a low ratio directly hurt rankings?
There is no confirmed direct ranking effect from this ratio alone. It matters more as a symptom: a very low ratio often coincides with slow-loading, code-heavy pages, which do affect page experience.
How do I measure visible text and total page size?
Browser developer tools and many SEO crawlers can report the size of the rendered text separately from total page weight, or you can estimate text size from a word count and average bytes per character.
For a related loading and responsiveness check, see the Core Web Vitals checker.