Yes folks, there is an easier way.
It’s common knowledge that whitespace in HTML code creates unnecessarily larger file sizes, increases bandwidth usage and slows down page load time. The only real reason to add whitespace to your code is for organization, but I have rarely found that helpful. Many HTML editors take the liberty of adding massive amounts of whitespace to your code for you. I guess they aren’t thinking about the real world.
Okay, just in case you don’t know what I mean, I’ll give you an example.
Below is a sample HTML table I just set up using Dreamweaver:
Do you see those unnecessary spaces before the TR and TD tags? Yup, that’s whitespace. Each one of those little spaces makes your web page larger.
So, how do you get rid of all that whitespace without going through all your code and making use of your delete key? It’s easy. I recently found a website called “Design215 Whitespace Remover” that does exactly that…and fast.
All you do is copy and paste your HTML code in the top white box and click on the “Compress” button. The tool removes all the whitespace in the code and shows the result in the bottom box. Copy and paste that code and you’re all set.
Here is what it did to the above code when I compressed it:
Pretty sweet.
FYI, the removal of whitespace is not a worthwhile endeavor. Any decent web server is configured to use “gzip” encoding for the serving of html documents. The whitespace is readily compressed and will be not significantly change the amount of data involved in serving the document. While the end result will be smaller, it will not be a nearly as large of a gain as casual observation would suggest.
You are correct. For those who are on shared servers without the benefit of GZIP or MOD_DEFLATE, they have the option of removing some whitespace in their HTML. For others, getting rid of whitespace certainly helps clean up the code so it’s easier to read.
Hi – we built a free to use custom command for people who use Dreameaver to clean up whitespace with just one click of a menu item.