What is HTML Ratio and How Does It Affect My Site?

Although most search engines don’t explicitly consider a website’s text to HTML ratio as a factor when determining page ranks, maintaining a healthy range does benefit a number of other factors that do play a significant role in search engine results.

What is the text to HTML ratio?

Quite simply, HTML ratio is the proportion of actual on-page text and content (usually including link anchor text) compared to the size of the page’s entire source code. There are a number of free tools available to check your site’s ratio. While opinions vary wildly over what the ideal range of ratios is, we generally advise a ratio between 10 and 70 percent.

How can I fix it?

There are several ways to go about improving your ratio if it’s too low. Here are some options, ranked loosely in order of potential impact:

  • Move any inline JavaScript and CSS to external, minified files. This will usually have the most dramatic effect on your ratio, with the least effort.
  • Remove comments, unneeded code, and extraneous white space.
  • Check the validity of your HTML and fix any issues that come up.
  • Add more content. The other options generally offer more bang for the buck because they’re addition by subtraction, but if your code is clean, valid, and free of inline scripts and styles, you can bolster your ratio by adding more text.

Why does it matter?

As mentioned above, the ratio is not considered a ranking factor on its own, but it does contribute to several other criteria that search engines do consider.

The biggest impact you’ll see by cleaning up your site code is faster loading times. Pages which load slowly generally have higher bounce rates and lower conversion rates than pages that load without delay.  This infographic shows how page abandonment increases with load times and how site performance affects shopping behavior. Load times are considered by search engines as an important user experience factor, so a performance improvement here could provide a significant boost to page rankings.

Clean and valid code is also easier for search engines to interpret, which means it’s more likely they will correctly figure out what your site is about and therefore what it should be ranking for. It also has the added benefit of being easier for you or your development team to edit and maintain.

While the ratio is evaluated independently on a page-by-page basis, search engines may consider the ratios of all pages on your site collectively when determining overall site health. This is another reason why cleaning up any templates and shared source code is more effective, with less effort and expense, than simply adding more content to increase the ratio.

Of course, there are always exceptions to any rule – our suggested 10 to 70 percent range is only a ballpark and it may make sense for individual pages to have a ratio that lies outside of it. User experience should always be the primary concern, and increasing your site’s ratio may be an easy way to improve it.