gzipping assets is one of the simplest and most effective things you can do to make your web site faster.

gzip compresses text files especially well. Taking a 2MB JavaScript file as an example, it compressed down to 463K — that’s around 80% savings! However, file size savings with gzip are variable because of the way gzip compression works. It uses an algorithm which replaces repeated occurrences of data with references. Therefore the more text you have repeated in the file, the more file size savings gzip will give you. (This is not an excuse to copy and paste a bunch of code!)

For text files we are sending over networks, gzip is a big win and a no-brainer. However, images and other binary files should already be aggressively compressed, and you usually won’t benefit from gzipping them. In fact, binary files can increase a tiny bit in size because of added gzip headers. See this post for more details.