2. Enable Compression

Most modern browsers support data compression for HTML, CSS, and JavaScript files. This allows content to be sent over the network in more compact form and can result in a dramatic reduction in download time. Compression is a simple , effective way to save bandwidth and aped up your website.

Gzipping generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip.

we recommend a minimum range between 150 and 1000 bytes. Gzipping files below 150 bytes can actually make them larger.


To make the compression most effective, do the following:


Compressed HTTP Resopnse
  • Specify CSS key-Value pairs in the same order where possible. i.e alphabetize them

  • Specify HTML attributes in the same order , i.e. alphabetize them . Put href first for links , then alphabetize the rest.

  • Use consistent casing, i.e. use lowercase wherever possible.

  • Use consistent quoting for HTML tag attributes , i.e always single quote, always double quote, or no quoting at all where possible

  • Minify JavaScript and CSS. Minifying JavaScript and CSS can enhance compression both for external JS and CSS files and for HTML pages containing inlined JS code and style blocks
Don't use gzip for image or other binary files.

Image file formats supported by the web, as well as videos, PDFs and other binary formats, are already compressed; using gzip on them won't provide any additional benefit, and can actually make them larger. To compress images