gzip has been around for quite some time,
brotli is a relatively new compression algorithm built by Google that best serves text compression.
brotli also has an advantage over
gzip since it uses a dictionary of common keywords on both the client and server-side, which gives a better compression ratio.
These compression methods are widely used to increase the performance of web apps. A study by Google reveals:
- 40% of people leave a website that loads in more than 3 seconds.
- 1-second time delay in page response reduces conversions by 7%.
That's why using these compression methods will result in the best performance and least maintenance.
It's recommended to leverage the Vercel Edge Network compression over a self-hosted solution. This is done by sending
br along with
gzip in the
Accept-Encoding request header.
Any client that sends a request to your deployment needs to define the Accept-Encoding header to opt into compression. Many clients (e.g., browsers like Chrome, Firefox, and Safari) already do this out of the box. If you're requesting another type of client, make sure you use the
Accept-Encoding header to take advantage of compression.
This is how you ask the Vercel Edge Network to compress using brotli:
Nevertheless, some clients might not support it, so to use gzip:
- HTML files are 21% smaller than
- CSS files are 17% smaller than
Assuming that the program requests deployment resources with the appropriate
Accept-Encoding header, the response will be compressed automatically.
The Vercel Edge Network regularly maintains a configuration file for the MIME types that will be compressed for both