Code To Text Ratio: What You Need To Know

When it comes to optimization of a web page for search engines and rank the content well, we, SEO nerds, weigh on...

Written by Deepanshu Gahlaut · 3 min read >
what is code to text ratio

When it comes to optimization of a web page for search engines and rank the content well, we, SEO nerds, weigh on many factors.

Code to Text Ratio is one of these factors that still make lots of SEO professionals worry.low text to code seo issue data

Source: Statista, research showed a warning of ‘low text-to-HTML ratio’ on 28% of total sites analyzed.

But in this era of smart and intelligent Google search, does Google algorithm consider the Text To Code ratio on your web page? Should you look for an optimal ratio for each page on your website to improve its SEO presence?

Staying on top of Google search ranking requires a lot of efforts and experiments with your SEO strategy. That’s why it’s important to understand concepts like Text To Code ratio and its impact on your organic search presence.

If you don’t want to scroll down, you can click on the following section to go right to it.

What is Code To Text Ratio?
How To Calculate Code To Text Ratio?
Effect of Low Code To Text Ratio on Your Website SEO
Tips to Improve Low Code to Text Ratio
Final Thoughts

So, let’s get started.

What is Text to Code Ratio?

Code To Text Ratio, also known as Text-HTML ratio or Text to Code Ratio refers to the amount of text you have on your webpage compared to the amount of code on the same page. Most SEO tools such as SEMrush trigger this warning when this ratio is 10% or less.

How To Calculate Text to Code Ratio?

For example, your webpage contains 50 KB (50,000 bytes) of code size and 5 KB (5000 bytes) of text size, then the text to code ratio will be (5000/50,000)*100 = 10%.

Instead of doing a manual calculation, you can use following tools to calculate Text To Code ratio for your web pages.

Effect of Low Text To Code Ratio on Your Website SEO

Today, websites are growing in their design and functionality to provide a good user experience, collect user data, and to stay on top of the trends. However, this requires a lot of code and can make the page size large. To deliver a fast and seamless experience to users, this code should be optimized while putting the high-quality and informative content on the page.

But, what if your page has a low text to code ratio? Won’t it hurt your search engine rankings?

Here is a direct answer from Google Spokesperson, John Muller:

“As far as I know, we don’t use the text to HTML ratio for anything. So this is something that some SEO tools came up with at some point. But from our point of view, we don’t use that at all.

I wouldn’t focus on a metric like that unless there is something of value you can pull out of that for the users. Maybe what you could be looking at there is seeing that these pages are bloated HTML and when you serve them to users, especially on mobile, it slows everything down. That’s one aspect that could be playing a role there, which is more between you and your users.

But at least from a search or SEO point of view, we don’t look at the text to HTML ratio at all.”

And here is the second answer from John –

“No. We don’t use anything like text to code when it comes to Google search. We especially pick up the visible content on the page, and we use that. Some pages have a lot more HTML, and some pages have a lot less HTML. That’s more a matter of your kind of design preferences; how you set things up on your site.”

Simply put, according to Google this issue doesn’t have a direct impact on your search presence, but having more code on the page can increase the page size and load time, especially on mobile.

Sometimes a poorly coded website (with unnecessary scripts, plugin code, minified Javascript and CSS file, unoptimized resources such as images) can lead to the large code size. There is also a scenario, for example, contact us and free trial page on your website will always have less text and more code, and that is OK.

While low Text To Code ratio should not be your one of your SEO priorities but it is a good chance to review your page code and optimize every byte. Achieve a great user experience on your website is not a small feat that’s why improving this ratio is critical.

You can improve the Code to Text ratio by following these –

  • Adding relevant text where necessary.
  • If the size of your page code exceeds the size of the text on the page, review your page’s HTML code and consider optimizing its structure and removing unnecessary comments, scripts etc.
  • Minify JS, CSS and HTML files.
  • Optimize static resources such as images.

Here is a good reference from Google for building amazing web experience. Check this out –

Final Words

So, what should be the text to code ratio? Is there any average or a good number to follow? The simple answer is that there is no good number for Code to Text ratio.

But to make things better and improve your search user experience, you should optimize your code – every single byte. Consider this issue as an opportunity to improve and optimize page code and content.

What are your thoughts on this? Have something to add? I’d like to hear your comments on this widespread SEO issue.

Written by Deepanshu Gahlaut
I write on SEO, content marketing, latest technologies, and social media. You can find me online, or at home watching sci-fi movies, listening songs, or sleeping. In addition, my latest obsession is creating, collecting and organizing visual content on my new blog - Infopixi, to help bloggers, marketers, and businesses. Profile

2 Replies to “Code To Text Ratio: What You Need To Know”

  1. Next time my managers going to ask me to add content of a webpage for maintaining the Text to Code ratio, I’ll refer this article to them. ??

Leave a Reply

Your email address will not be published. Required fields are marked *