Register for this year’s #ChromeDevSummit happening on Nov. 11-12 in San Francisco to learn about the latest features and tools coming to the Web. Request an invite on the Chrome Dev Summit 2019 website

Enable Text Compression

Overview

Text compression minimizes the byte size of network responses that include text content. Less bytes downloaded means faster page loads.

Recommendations

Lighthouse lists each response that was sent without text compression. Enable text compression on the server(s) that served these responses in order to pass this audit.

How browsers and servers negotiate text compression

When a browser requests a resource, it lists what text compression encodings it supports in the accept-encoding request header. All modern browsers do this. The server encodes the response in one of the formats that the browser supports and indicates which format it used in the content-encoding response header.

See Optimizing Encoding and Transfer Size of Text-Based Assets to learn more.

How to enable text compression on your server

Configure your server to compress the response with Brotli, if the browser supports it. Brotli is a newer compression format, but it's not universally supported in browsers. Do a search for "how to enable Brotli compression in <server>" to learn how to implement it, where <server> is the name of your server.

Use GZIP as a fallback to Brotli. GZIP is universally supported in all modern browsers, but is less efficient than Brotli. See Server Configs for examples.

Check if a response was compressed in Chrome DevTools

To check if a server compressed a response:

  1. Go to the Network panel in DevTools.
  2. Click the request that caused the response you're interested in.
  3. Click the Headers tab.
  4. Check the content-encoding header in the Response Headers section.
The content-encoding response header
Figure X: The content-encoding response header

To compare the compressed and de-compressed sizes of a response:

  1. Go to the Network panel.
  2. Enable large request rows. See Use large request rows.
  3. Look at the Size column for the response you're interested in. The top value is the compressed size. The bottom value is the de-compressed size.

More information

Lighthouse gathers all responses that:

  • Have text-based resource types.
  • Do not include a content-encoding header set to br, gzip, or deflate.

Lighthouse then compresses each of these with GZIP to compute the potential savings.

Feedback

Was this page helpful?
Yes
What was the best thing about this page?
It helped me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had the information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had accurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was easy to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
No
What was the worst thing about this page?
It didn't help me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was missing information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had inaccurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was hard to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.