Gzip compression allows reducing file size when transferring from server to user browser. We can enable Gzip compression by writing few lines of code in .htaccess file. For enabling Gzip compression, we need Apache's mod_deflate module enabled. If it is not already enabled, you can enable using the steps provided here.
# BEGIN GZIP
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE image/jpg
  AddOutputFilterByType DEFLATE image/jpeg
  AddOutputFilterByType DEFLATE image/png
  AddOutputFilterByType DEFLATE image/gif
</IfModule>
# END GZIP
The above code, will compress html, css, js and image files before sending to users browser.

Reference:

Submitted by ychaugule on