What is Text-to-HTML Ratio & Is It Really Important

by Jay | Updated on November 23rd, 2022

If you’re a webmaster or SEO specialist, then you know that text-to-HTML ratio is an important factor in search engine optimization. But what is text-to-HTML ratio? And why does it matter? In this blog post, we’ll answer those questions and more.

What is text to HTML ratio?

Text-to-HTML ratio is a metric used by search engines to determine the quality of a web page. It is the ratio of the amount of text on a page, compared to the amount of HTML code. A high text-to-HTML ratio indicates that a web page has high-quality content.  

Text is included in the HTML that makes up your web page. Your text-to-HTML ratio is low if you use a lot of HTML code to display a small amount of content.

As an illustration, if you use 10.000 characters of HTML to display 200 characters on your user’s screen, your text-to-html ratio is 200/10.000 = 2%. That is little.

In contrast, your text-to-HTML ratio would be 40% if you only needed 500 characters of HTML to display the same 200 characters. It’s much better now.

What is the Ideal HTML-to-Text Ratio?

Anywhere from 25 to 70% of the HTML should be text. As opposed to HTML elements, picture tags, and other non-visible information, this proportion only applies to the visible text ratio. You may have noticed that many websites with good search engine rankings include content that can be read.

Does the text-to-HTML ratio matter for SEO?

Actually, no, redundant code may slow down your page, which may have a negative impact on your rankings. The quantity of HTML does not significantly affect page speed, though.

The text-to-HTML ratio is typically not the most crucial concern for SEO campaigns.

Although the text-to-HTML ratio is not an official ranking factor, there are many reasons why it is still important to focus on SEO. For one, a high text-to-HTML ratio can strongly affect the end-user experience.

A well-written and easy-to-read website will keep users engaged longer, which is important for both SEO and conversion purposes. Low ratios may cause confusion for web crawlers because they lack sufficient information about a specific web page.

So while the text-to-HTML ratio may not matter directly for SEO, there are many indirect benefits that make it worth paying attention to.

How does Google use this metric?

While many elements connected to the HTML-to-text ratio demonstrate appropriate SEO practices, the ratio itself is not a ranking indication. Google’s John Mueller said that it is not a ranking factor. Therefore, this ratio could inadvertently lower your rating. But this does not imply that you should ignore it.

Here are some justifications for why it would be wise to improve it:

  • It is how Google determines whether a page is relevant. Therefore, it is best if there is a higher text-to-code ratio.
  • The ratio can also assist HTML-intensive pages to be better by, for instance, deleting extraneous tags. HTML-heavy pages may negatively affect user experience and loading times.

Why text-to-HTML ratio matters

Build for people

Websites with a higher text-to-HTML ratio typically have better usability. Instead of search engines, they are readable and engaging to the intended audience.

Faster loading times

When it comes to page load speed, less code is better. Less code means faster loading times for websites. That helps to improve the user experience. Remember that page load time affects rankings as well.

Better user experience

Today, search engines like Google consider a better user experience a key ranking element. It seems sensible to increase this ratio now that a more excellent text-to-code ratio suggests better UX.

Better indexing of pages

For search engines to crawl and index a website, they need a cleaner, more compact code and a higher percentage of plain text. Remember that improving your text-to-HTML ratio will be fine with your rankings.

How to use code-to-text ratio in SEO?

From the standpoint of SEO, the Code to Text Ratio should be used as:

An indicator for the size of text

Calculating the text-to-HTML ratio, you can find out how big the plain text is on a page. However, more material does not automatically equate to better rankings.

Google excludes information that is larger than 100 kilobytes. Therefore, if your page contains 150Kb of text, consider breaking it up into many pages that are more narrowly focused. That will benefit both users and SEO.

An indicator of inefficient coding techniques

The text-to-code ratio measures the amount of content on a page about its coding structure.

Generally speaking, it’s ideal to utilize as little code as feasible. A page with much material may have inefficient code if the text-to-HTML ratio is low. whenever possible, try to lessen the amount of code on a page.

An indicator for page load speed

More code is present when the code-to-HTML ratio is lower. A lot of code also results in a slower page load time. Google uses page loading speed as a ranking factor. As a result, in some cases, a low code-to-text ratio indicates that the page will be ranked less.

How to calculate text-to-HTML code ratio

You can manually check the ratio or use one of the many online tools to do this for you. Let’s go thru both these methods.

Manual method

You must determine the sizes of your HTML code and text content to manually compute the ratio. Here is the formula and step-by-step procedure.

  1. Use Notepad or Text Editor and save the website’s source code. The source code can be obtained in numerous ways (e.g. right-click on a webpage in Chrome browser and click view page source). Make a note of this notepad’s size. This is the size of your website’s code and content combined.
  2. The notepad should only contain text after all the code has been removed. Make a note of this notepad’s size. This is the length of your text.
  3. Subtract the notepad size for the text from the notepad size for the webpage. This is how much code you have.
  4. Figure out the ratio as

(Text Size) 100/ (Size of code)

WordPress provides two types of content editor demonstrations: a visual model that displays content creation as posted and a text model that shows HTML content.

Click the “text” option in the top right corner, copy the entire content, and then separate the content text from the HTML code text to see how much HTML is there in the text. Once the code has been split, assess the amount to determine whether it exceeds 8:22 percent. You will require more code if it falls within this range. You must include more text or content if higher.

Online text-to-code ratio checking tools

This calculator, among many other free web resources, can perform this computation for you. The program will compute the ratio after you enter the URL of your website.

As previously said, this ratio has little bearing on SEO, but it can be a sign of other problems like flimsy content or ineffective code. Therefore, combining this ratio with a technical site audit and an on-page site audit is always a good idea to boost overall SEO health.

Numerous SEO tools, including SEMrush, incorporate this ratio in the site assessment and figure out the ratio for all of your web pages automatically. Then, you can consider this ratio in conjunction with other SEO factors like a low word count and ineffective coding.

How to fix a low HTML to text ratio

  • Any CSS and Javascript should be placed in separate files. Javascript and inline CSS should be avoided whenever possible.
  • Check the HTML code. Starting using the W3 HTML Validator is highly recommended.
  • Remove any extra HTML that is not necessary for the page to show.
  • Look for and remove any commented-out code.
  • Get rid of any extra code.
  • Eliminate vast white spaces
  • Avoid using many tabs.
  • Remove code comments and steer clear of tables. Use tables only if they are necessary for your layout.
  • Use CSS for formatting and styling.
  • resize the pictures
  • Remove any pointless pictures
  • Use Flash and Javascript only when necessary.
  • Keep your page under 300 kb in size.
  • Delete any concealed or people-unreadable text.
  • Ensure your links pass link juice and employ internal linking to assist consumers in navigating your website.
  • There must always be some introductory text on your page. Include content that is clear and contains valuable user information.

You should be able to increase your text-to-HTML ratio with these suggestions. While it won’t help your site reach Google’s top spot, doing that will make it a little faster and more user-friendly.

Why good Text To HTML ratio is not always achievable

You should be able to increase your text-to-HTML ratio with these suggestions. While it won’t help your site reach Google’s top spot, doing that will make it a little faster and more user-friendly.

  • Very few code elements are needed for each page due to their brief length (contact us, etc.). Some short pages will always have more code than text.
  • media-rich webpages (galleries, videos)
  • websites that employ Flash or Ajax


I've worked for WooRank, SEOptimer, and working on a cool SEO audit tool called SiteGuru.co. Now I have build Linkilo and SEO RANK SERP WordPress theme. I've been in the SEO industry for more than 5 years, learning from the ground up. I've worked on many startups, but also have my own affiliate sites.