The other night I decided to look into HTML compression for Sencha.com. The first Google result led me to HTML Compressor.
Our homepage weighs about 30KB. When using the most aggressive settings, I only saved 5KB. Once gzipped, this reduction in file size only nets a savings of 500 bytes.
In my test case, the savings was not significant enough to worry about. But if you have a very large page, and are particularly worried about mobile where every byte matters, the HTML Compressor might be for you.
Original | 30,056 bytes (33 KB on disk) |
Compressed (Aggressive) | 25,025 bytes (29 KB on disk) |
Gzipped Original | 7,337 bytes ( 8 KB on disk) |
Gzipped Compressed | 6,801 bytes ( 8 KB on disk) |
You can actually try gzipping on Mac OS X, using Terminal to modify your files, and confirm the difference in the Finder:
- Place your file on the Desktop, then make a quick copy, as gzip will overwrite the file.
- Switch to Terminal and type
cd ~/Desktop
thengzip myfile.html
. - Your original file is gzipped, and has a
.gz
extension. Use the Inspector, ⌘⌥I, to review the file size of your gzipped file and the copied original.