HTML Compressor FAQ

How do I use the HTML Compressor?

Usage is easy. Simply enter the address of the page you want to compress, for example http://www.mydomain.com/mypage.html, into the page field. Then click on Compress or press enter.

Note that the page you wish to compress has to reside on a domain and be accessible from the Internet. HTML Compressor does not currently allow you to compress pages that are located on your computer.

After you've clicked on Compress, the tool fetches the HTML page from the address you have provided. It attempts to reduce the size of the file by using multiple different techniques (see "What does this tool actually do?").

Once the compression is complete the results will be displayed to you in a box similar to the one below:
 

Example of the results provided by HTML Compressor

Under "Page:", you will see a link to the compressed version of the page you provided. Right-click on this link and save the compressed page to your hard drive; then upload it to your web server, replacing the uncompressed version. Do note: As the compressed HTML is extremely hard to read, be sure to keep a readable version of your page somewhere safe.

Below "Original size:" and "Compressed size:" you will see the size of the page (in bytes) before and after the compression took place. This helps you estimate how much weight your page has shed in the process. Under "Ratio:", you'll see how the compressed page's size compares to that of the original page. A small percentage indicates good compression, while a high one suggests that the size did not drop much.

In default operating mode, HTML Compressor uses all possible optimizations. However, you can customize the operation of the tool by clicking on the "config" link, surrounded by a red box in the image below:

Back to HTML Compressor

A picture of the HTML Compressor screen with the config link highlighted.

What does this tool actually do?

In brief, it removes all of the unnecessary characters from a HTML page. HTML Compressor does not affect the visual appearance of your page or its contents. It just compacts all the tags and other markup information into a space that is as small as possible.

This tool, like all other HTML-applications, assumes that your HTML is valid. Unfortunately, most HTML documents on the Internet do not adhere to the standards. Thus, provisions have been made to ensure that the HTML Compressor also works with HTML that is less-than-perfect. Nevertheless, it is recommended that you validate your HTML before using the compressor.

Unlike some other HTML compressors, this tool does not create errors to your HTML document. In other words, if your file was valid before the compression, it will stay that way.

So, what about the details? Let's take a look at the configuration screen:

The HTML Compressor configuration screen.

Remove comments: When this option is checked, the program will remove all HTML comments from the file. The strings <!-- and --> are removed, as well as everything between them. Comments within <pre>, <script> and <style> tags are not removed by this option.

Remove unnecessary tags: When enabled, the HTML Compressor removes tags that are optional according to the HTML specification. For example, many end tags are not required as the next start tag implies the end of the previous element.

Remove unnecessary spaces: Multiple spaces are treated as a single space in HTML, meaning that "     " is seen as " ". Unnecessary spaces add to the size of your HTML file without contributing to the layout of your page.

Of course, there are exceptions to this rule. Multiple non-breaking spaces (&nbsp;) are not collapsed into one space, and text inside a <pre> tag is displayed as-is, without collapsing whitespace. For these reasons, HTML Compressor does not tamper with non-breaking spaces or text that is within a <pre> tag. Whitespace within <script> and <style> tags is also preserved.

Replace tags with shorter ones: Replaces all occurrences <strike> tag with <s>, a shorter tag with the same meaning. No other tags are replaced, as there are no shorter versions of other tags. For example, <strong> and <b> may look similar, but their meaning is different.

Remove unnecessary quotes: Strips out all quotes that are not required by the HTML standard. The function takes into account that some attribute values must be quoted and others don't. For example, quotes must be preserved in <BODY bgcolor="#FFFFFF">, but they can be stripped from <IMG src="myimage.png" height="77" width="23">.

Remove newlines: When checked, the program removes all newlines (line changes) from the page, effectively turning the page into one really long line of text. What do you mean it's harder to read now? Newlines are not removed from text within <pre>, <script> or <style> tags.

Remove HTML comments inside <SCRIPT> and <STYLE> tags: Does just that, strips out HTML comments within these tags. Note that "Remove comments" does no such thing - this option needs to be checked.

People often add HTML comments to their <SCRIPT> tags to prevent older browsers from mistakenly displaying the contents of the <SCRIPT> tag. There really is no need to do that anymore, as no browser that understands HTML 3.2 requires such a safety measure. HTML 3.2 was introduced way back in 1997, so no harm should be caused by removing these comments.

Back to HTML Compressor

How effective is HTML Compressor?

The answer depends on the HTML file you feed it. A file with many tags and little text tends to compress well, while one with plenty of text and very few tags doesn't. Typically the compression ranges between 80-95%, so the file size drops 5-20%.

HTML Compressor should be the most effective tool for compressing your HTML, but if you find a program that crunches your HTML into an even smaller size, let me know about it.

Back to HTML Compressor

Why should I compress my HTML?

Why shouldn't you compress your HTML? Compressing it means saving bandwidth and reducing the load time of your page. The more hits your page gets, the more important this becomes. Besides, wouldn't it be great to be able to brag to your friends that yours is the smallest?

Back to HTML Compressor

How can I send feedback?

Simply contact me via this online form. I'm happy to receive any suggestions or comments you might have.

Back to HTML Compressor