The idea here is exactly as the heading describes, to clean up your HTML code so it is as efficient and lean as it can be. There are a variety of basic changes you can undertake to help make your pages have a better content to code ratio (the less code as compared to content, the better).
Table of Contents
Optimize image sizes for faster load time
Everyone wants to have great looking images on their web pages, but those images should not interfere with the quick loading of pages. It doesn’t help to have high resolution images which are then reduced in size to fit on your page. All this does is make your pages load slower.
So instead of having large images, which are resized for use, why not use images that are the exact size that you need? Also make sure you are using the appropriate file format for the situation, so avoid using a .BMP format when a .JPEG, .GIF, or .PNG would do just fine.
Avoid using tables
For a while now, web developers have moved away from using tables and are using CSS based site structures instead, which cuts down on the amount of code on the page. However, there are still some web developers who have either not acquired the new skills necessary to work with DIV elements and CSS to construct their pages, or have not yet updated their clients’ websites to eliminate the use of tables for general website layout.
It could also be the case that you developed your website yourself and need help to make this transition. Regardless of the reason, it is important for SEO purposes to move away from table-based layouts to help slim down your HTML code. This will not only help load the page slightly faster, but also reduce the content to code ratio, which can positively impact organic search engine rankings.
Eliminate unnecessary code
Remove any part of the code that is not necessary to make your pages function properly. For example, if you have excessive commenting (especially if it was used to insert keywords into your code), then trim down the comments to leave only the essentials.
Another thing to look for is the excessive nesting of DIV layers, paragraphs, and other HTML elements which generally come along with the lack of mastery over CSS. So eliminate as much nesting of code as possible to reduce the amount of HTML on your page.
Though this is not crucial, and your site can rank decently without a properly validated HTML, a W3C validation will help you eliminate a lot of the problems that creep up on developers and website owners. So try to make your pages standard compliant when possible. Use the W3C Markup Validator to validate your code.