What is the Code to Text Ratio?
Every webpage has a certain amount of code and a certain amount of regular text. The Code to Text Ratio (a.k.a. Text to HTML ratio) represents the percentage of actual text in a web page compared to the percentage of HTML code on the same page.
Basically, it tells you what’s the percentage of that page that is text.
How to calculate your Text to HTML Ratio?
There are many online tools, which automatically calculate the code to text ratio of a page.
All you need to do is to specify the URL of the page you want to analyze. Then the tool will take the source code of the page and will automatically extract the text from paragraphs and anchor text from HTML code.
The tool will return a percentage: that’s the content ratio of the page. This percentage refers to the visible text ratio, as opposed to HTML elements, image tags and other non-visible information.
Here are some examples, of tools that I use to quickly calculate text to HTML ratio:
In addition to the Text to Code Ratio, these tools will give you interesting information, such as: Page Size, Code Size, Text Size etc.
Is the Code to Text Ratio Important for SEO?
The Text to HTML ratio is not a direct ranking factor for search engines. Search engines evaluate a website depending on the quality and not the quantity of its content.
That’s why some SEO experts believe that the text to HTML ratio is meaningless and that it’s highly unlikely that a search engine will evaluate a website based on that.
Bu other specialists believe that the code to text ratio of a page can be used by search engines to calculate the relevancy of a webpage. A lower code to text ratio (less text) could cause topical confusion, because crawlers won’t have enough information about the nature of your website.
Personally, I think that the text to code ratio doesn’t have a significant impact on SEO, but it is not completely useless. I often use it as an indicator of the quality and the code efficiency of a web page.
How to use code to text ratio in SEO
From an SEO perspective, Code to Text Ratio should be used as:
An indicator for the size of text
By calculating text to HTML ratio you’ll discover what’s the size of the plain text on a page. But more text doesn’t always means higher rankings.
Google ignores content beyond the first 100Kb. So if it turns out that you have 150Kb of text on one page, you should think of splitting the content into several more focused pages. That will be better for SEO and for users.
An indicator for an inefficient coding techniques
A page’s text to code ratio is a measure of the quantity of content compared to the structure of the web page.
In general, it’s best practice to use the least amount of code possible. If you see a low text to HTML ratio for a page that visibly has a lot of content, this may be a sign of inefficient coding. Try to reduce the amount of code on a page, whenever that’s possible.
An indicator for Page Load Speed
A lower code to HTML ratio means more code. And a lot of code means slower Page Load Speed. The loading speed of a web page is a ranking factor for Google. Therefor, in some situations, low code to text ratio is a sign that the page won’t receive high rankings.
What’s a good Text To HTML ratio for a website?
There’s no one right answer to this question.
A good text to HTML ratio can be anywhere between 15 to 80 percent. However I’ve seen pages with lower ratio (lower than 10%) that still perform very well in the SERPS.
And also: higher ration doesn’t guarantee higher rankings.
My website has a low code to text ratio. Now what?
By now, you should have understood that improving the text to HTML ratio should NOT be one of your SEO priorities.
But low ratio could be an indication for inefficient coding, which is a precondition for bad SEO performance. In this situation, you need to make sure that you code is efficient and readable by crawlers.
Here’s how to do that:
- Check if your HTML code is valid – You can do that on http://validator.w3.org/. Invalid html can cause issues for crawlers and users. Remove all invalid code.
- Check how efficient is your code by evaluating your page’s loading speed – Many aspects of page’s speed depend on the efficiency of the code. Google’s Page Speed tool can give you some advices how to improve your pages’ loading times and therefore improve the efficiency of pages’ code.
- Remove any unnecessary code – huge white spaces, lots of tabs, comments and pings: they all result in creating a big amount of code on the page.
- Avoid tables. – Tables also create a lot of HTML. So use them in your layout only if absolutely necessary.
- Use CSS for styling and formatting.
- Resize your images and remove any unnecessary images.
- Keep the size of your page under 300kb.
- Remove any hidden text that is not visible to people.
- Your page must always have some amount of plain text. Include easily readable text with quality user information..
Why good Text To HTML ratio is not always achievable
You can’t always have high code to text ratio.
Here are some cases, in which achieving high ratio is technically impossible:
- Very short pages (contact us … ) – each page requires a minimum number of code elements. On some short pages, the code will always be more that the text.
- Media-heavy pages (galleries, videos)
- Pages that use Flash or Ajax
In conclusion: Stop calculating ratios! Focus on content and coding practices
There are more important things to worry about than the code to HTML ratio of your pages.
If your website developer is using good coding practices and your pages are built using only the necessary minimum of HTML/CSS, then probably you have nothing to worry about. Even if the code to content ratio is low.
Problems may occur when source code of your pages is littered with useless HTML and CSS but increase the code to text ratio shouldn’t be an SEO priority.
And you? Do you oversee the text to code ratio of your website? Do you use it to evaluate your SEO performance?