Measure compression and source bytes separately

Use response headers and a repeatable HTTP request to check gzip delivery.

Website Performance2 min readPublished Last edited Automated editorial check:
On this page

An asset can be small in its minified source and have an even smaller transfer representation. Minification transforms the source. HTTP compression changes how that source is transported. A release worksheet should keep both measurements and say which representation was counted.

Compare the same public asset

On a staging origin you control, request a stylesheet once with Accept-Encoding set to identity and again with gzip. Save response headers and body separately. Check Content-Encoding before interpreting the sizes. An already compressed file, a very small response, an unsupported MIME type or a cache rule can produce an identity response despite the gzip request.

In the ByeGA4 Lab, the CSS example changes from 70 to 30 uncompressed UTF-8 bytes after minification. This is the source comparison. A server with a minimum compression threshold can choose to send the 30-byte result unchanged. Do not expect every response to be smaller on the wire simply because gzip is available.

Separate network and browser measurements

If your measurement tool automatically decompresses the body, the saved bytes may represent decoded content. Check whether transfer size includes response headers or cache behavior before comparing. Record CDN status, Content-Encoding and Vary alongside each result. A cache hit at the edge can still transfer bytes to the browser.

Repeat the test after clearing the browser's cached response or using a controlled HTTP request. Keep the same URL and verify the status each time so you don't accidentally measure a redirect or an HTML error page in place of the stylesheet.

Reading and practice

Related guides

Search ByeGA4