Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information (Cookie Policy)

Text to HTML Ratio: What It Is, How to Calculate It and Whether It Affects SEO

Text to HTML ratio is the share of a page's code that is visible text. Learn the formula, typical values, what Google says and how to check yours.

Sorank customerSorank customerThomas Girauc, Sorank customerCelio Fabiano, Sorank customerSorank customerXavier Breull, Sorank customer
+ 9'000 Subscribers
Text to HTML Ratio: What It Is, How to Calculate It and Whether It Affects SEO
Notification: your site reached 20K clicks from Google Search in 28 days

Tools

On this page

Summary

Text to HTML ratio is the share of a page's code that is visible text. You find it by dividing the size of the text by the size of the whole HTML file, then multiplying by 100. Google does not use this ratio as a ranking signal, but a bloated page can still slow down crawling and loading.

Want to go further? Ask

Text to HTML ratio compares the words a visitor reads with all the code that builds the page, including tags, scripts and styles. A high ratio means most of the file is content. A low ratio means the markup does most of the work. You will see this metric in many SEO audit reports, but the question behind it is simpler: is your page light, clear and full of useful text?

How is the text to HTML ratio calculated?

You divide the size of the visible text by the size of the full HTML, then multiply by 100. Use the same unit for both numbers, either characters or bytes.

Text to HTML ratio = (size of the visible text / size of the full HTML) × 100

Here is a simple example. A page has 500 characters of visible text inside 1000 characters of HTML. The ratio is 500 divided by 1000, times 100, so 50 percent.

What is a good text to HTML ratio?

Many SEO blogs quote a range of 25 to 70 percent. We found no study or Google page behind that range, and the sites that repeat it name no source. Treat it as a rough guide, not a target.

The right number also depends on the type of page. Articles and blog posts contain a lot of text, so they tend to score higher. Product pages with image grids, filters and tracking scripts tend to score lower. A low score on such a page is normal and does not mean the page is broken.

Does the text to HTML ratio affect rankings?

Not directly. John Mueller, Search Advocate at Google, said on Reddit that the ratio "makes absolutely no sense at all for SEO". Search Engine Roundtable reported his comment on August 11, 2023. So you should not chase the number as a ranking goal.

The ratio can still matter indirectly, because a heavy page can cause real problems. Google's crawler documentation says that Googlebot crawls the first 2MB of a supported file type, and that the limit applies to uncompressed data. Googlebot does not read past that point, so content placed after it may never be seen. That is a crawling problem, not a ratio problem, and it is the number to check.

Google Search Central page stating that Googlebot crawls the first 2MB of a supported file type, with the limit applied to uncompressed data
Screenshot of developers.google.com

Heavy code also slows the page down, which is why cutting code often goes together with page speed work.

What causes a low text to HTML ratio?

Most low ratios come from code, not from a lack of writing. The common causes are:

  1. Deep nesting of div tags, often produced by visual page builders.
  2. CSS and JavaScript written inside the page instead of in external files.
  3. Extra comments, long blocks of whitespace and table-based layouts.
  4. Large data blocks, such as the JSON that some JavaScript frameworks embed in the page. This code is often needed, so check what it does before you remove it.

Nesting is the easiest cause to fix with semantic HTML. A cleaner structure uses fewer wrappers and clear section tags:

<main>
  <section>
    <p>Your text goes here.</p>
  </section>
</main>

Our guide to semantic HTML explains which tags to use and why they matter.

How do you check your text to HTML ratio?

You can measure it by hand in a few minutes:

  1. Open the page, select all the visible text and paste it into a plain text file.
  2. Save the full page source, for example with View Source and Save As.
  3. Check the size of both files in bytes.
  4. Divide the text size by the HTML size, then multiply by 100.

To check the size limit, use our free page size checker. It tests a URL against Google's 2MB crawl limit, which matters more than the ratio itself.

Free page size checker that tests a URL against Google's 2MB crawl limit
Screenshot of sorank.com

Note

The ratio is a symptom, not a goal. Read it together with the page size, the load time and the text itself.

How do you improve your text to HTML ratio?

Work on both sides: cut code that adds nothing, and add text that answers a question. Start with these steps:

  1. Move inline CSS and JavaScript into external files, so each page carries less code.
  2. Replace generic wrappers with semantic tags such as main, section and article.
  3. Minify the HTML, and remove comments and hidden elements that no visitor sees.
  4. Expand thin product and service pages with specific details, such as sizes, use cases, common questions and reviews.

Keep the text useful. Filler sentences add words but no value, and they make the page harder to read. If a page is thin, content optimization can help rewrite it. Our thin content entry explains what to fix first.

Common text to HTML ratio mistakes

Chasing the number instead of the page

What it is: Treating the ratio as a score to raise. Pages get longer with no new information, the number moves, and the page does not get better.

How to spot it: Your edits add words, but the questions visitors ask are still not answered.

How to fix it: List the top questions for the page first. Then check that every paragraph answers one of them.

Filler text added to raise the score

What it is: Repeating the same keyword, or padding the page with generic sentences.

How to spot it: Paragraphs say the same thing in different words, or the text only reads well to a search engine.

How to fix it: Delete the padding. Keep only the sentences that give a visitor a fact, a step or an answer.

Deleting code the page needs

What it is: Removing scripts, styles or structured data to shrink the file, and breaking the page in the process.

How to spot it: A form, a menu, a price or a rich result stops working after the edit.

How to fix it: Move the code to an external file instead of deleting it, and test the page after each change. Keep your JSON-LD schema intact.

Why does text to HTML ratio matter for SEO and GEO?

For SEO, the ratio is a useful warning sign, not a ranking lever. It points you to bloated pages that may be slow, hard to crawl or close to Google's 2MB limit. For GEO, the same clean structure helps. AI systems need to find the answer inside your page, and clear headings with visible text are easier to read than a page buried in code. Aim for a page that both a visitor and a crawler can read in full, with a sound crawlability setup.

Check the content depth of each important page too. A page with more useful text and less code usually answers the question better.

Conclusion

The text to HTML ratio is the share of a page's code that is visible text. Google says it is not a direct ranking factor. Use it as a prompt to look at the page: is the code heavy, is the text useful, and does the page stay under Google's 2MB limit? Fix those three things, and the ratio usually follows.

Sources

Frequently asked questions

How do I calculate text to HTML ratio?

Divide the size of the visible text by the size of the full HTML, then multiply by 100. Use the same unit, bytes or characters, for both numbers.

Does text to HTML ratio affect Google rankings?

Not directly. John Mueller of Google said the ratio makes no sense for SEO. A bloated page can still cause crawling and speed problems, so check its size too.

What is a good text to HTML ratio?

Many SEO blogs quote 25 to 70 percent, but we found no study or Google page behind that range. Use it as a rough guide and judge the page by its content and load speed.

Our Blog for Ambitious Company

Testimonials from ambitious founders

0 to 10000 visitors in 5 months

Celio Fabianomonrobotlavevitre.frGoogleE-commerce

0 to 5000 visits in 8 months

Thibault BMsorank.comGoogleSoftware

0 to 1104 clicks in 4 months

Dominiqueflight-sensations-idf.comGoogleLeisure and aviation

0 to 163 clicks in 6 months

Coworking Pariscoworking-paris.frGoogleOffice broker

x92 clicks in 7 months

Guide Zanzibarguidezanzibar.comGoogleTravel