Identify suitable resources

HTML, CSS, JavaScript and other text-based formats often contain repeated patterns that compression can reduce. Already compressed media behaves differently, so applying another compression layer is not automatically useful. Start by measuring which resources contribute meaningful transferred bytes. Compression improves delivery of the bytes you keep; it does not remove unnecessary code or make a large application architecture simpler.

Understand the request and response

A browser advertises supported encodings through the request, and the server or CDN selects an appropriate representation. Content-Encoding describes the encoding applied to the response body. It is distinct from Content-Type, which describes the resource’s media type. Mixing these roles can produce incorrect metadata and a file that downloads but cannot be interpreted properly.

Test a concrete stylesheet

Suppose a generated stylesheet is 90 KB before transport compression. Request it through the public domain and compare the transferred size with the decoded resource size in developer tools. Confirm whether the response indicates br or gzip. The example does not imply a fixed savings percentage; results depend on the file contents and encoding configuration.

Check variants and hosting behavior

The cache and origin must handle encoding variants correctly so a client receives a decodable response. When serving precompressed files, verify that the host maps requests to the correct representation and headers. Uploading a .br file beside a stylesheet does not ensure that a generic static server will automatically negotiate and serve it.

Avoid misleading local comparisons

A development server, local file preview and production CDN may have different compression behavior. Measure the final delivery path and note whether the request is a cold download or a cached reuse. Compare equivalent builds and resources. A smaller source file, a compressed response and a cache hit are three different reasons for low transfer activity, with different implications for optimization.

Keep the verification repeatable

Record a representative HTML, CSS and JavaScript URL along with their encoding, media type and transfer result. Test a supported encoded request and a request without that encoding where practical. Recheck after host or CDN configuration changes. If an asset still dominates loading, investigate its necessity and request timing rather than treating transport compression as the only remaining performance lever.

Further reading

Put the idea to work.

Explore free browser tools for images, text and developer workflows.

Try a free tool