Does Your Text to Code Ratio Matter?
But is there an ideal text to code ratio?
Search Engine Optimization
Some SEO experts claim that higher text ratios improve search engine positions. I’ve even seen 42% stated as a magical perfect percentage which will boost your Google PageRank. However, I suspect that number’s been plucked by an SEO snake oil “specialist” with a Hitchhiker’s Guide to the Galaxy obsession.
Personally, I don’t believe the text to code ratio has a significant impact on SEO. That said, Google ignores content beyond the first 100Kb so larger pages could benefit from a higher text ratio. However, if you’re exceeding 100Kb, I’d suggest splitting documents into several more focused pages would be a more constructive SEO exercise.
In general, it’s best practice to use the least amount of code possible. Unnecessary tags incur additional page weight, slower downloads and more inefficient browser rendering. It also makes your code harder to maintain.
- Shorter pages will have a low text ratio because you require a minimum number of code elements to create a valid HTML document.
- Media-heavy pages, such as a gallery with images or videos, typically have low text ratio.
- Flash or Ajax-powered web applications may not have any content whatsoever — but it’s still there.
In general though, a text to code ratio which exceeds 50% is achievable on
most content pages.
So should we, as conscientious developers, measure our text to code ratios?
If you’re already using good coding techniques, there’s little need to bother. You could use it as a factor when measuring efficiency since a good developer will generally have a higher text to code ratio. However, ratios should never be considered in isolation. After all, a page scoring 25% which works everywhere is usually better than one which scores 50% but fails in most browsers.
Do you consider your page’s text to code ratios? Do you use it to evaluate your own performance?