HTTP compression reduces the number of bytes transferred for text responses such as plain-text documents, JSON payloads, and generated reports. That usually matters most on slower links or repetitive scripted downloads where the payload compresses well.
In wget, --compression=auto and --compression=gzip ask the server for gzip-compressed HTTP content, and wget expands the response back into a normal local file when the server replies with Content-Encoding: gzip. --compression=none leaves compression negotiation off.
Use compression for text-heavy HTTP downloads, not for archives or checksum-sensitive transfers where you need the exact bytes sent on the wire. Servers can also ignore the request, so the transfer is only compressed when the remote endpoint chooses to send a compressed response.
Related: How to send custom headers with wget
Related: How to throttle download speed with wget
Steps to use download compression in wget:
- Confirm that the local wget build supports compression control and note the default mode.
$ wget --help ##### snipped ##### --compression=TYPE choose compression, one of auto, gzip and none. (default: none) ##### snipped #####The default none mode means wget will not ask the server for compressed HTTP content until you enable it explicitly.
- Download a text file with compression enabled and inspect the server response.
$ wget --compression=auto --server-response --output-document=gpl-3.0.txt https://www.gnu.org/licenses/gpl-3.0.txt --2026-04-22 10:31:03-- https://www.gnu.org/licenses/gpl-3.0.txt Resolving www.gnu.org (www.gnu.org)... 209.51.188.116, 2001:470:142:5::116 Connecting to www.gnu.org (www.gnu.org)|209.51.188.116|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Wed, 22 Apr 2026 02:31:04 GMT Server: Apache Strict-Transport-Security: max-age=63072000 X-Frame-Options: sameorigin X-Content-Type-Options: nosniff Access-Control-Allow-Origin: (null) Last-Modified: Sat, 30 Sep 2017 07:16:26 GMT ETag: "894d-55a62eb645dcd-gzip" Accept-Ranges: bytes Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 12130 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/plain Content-Language: non-html Length: 12130 (12K) [text/plain] Saving to: 'gpl-3.0.txt' 0K .......... . 100% 12.7M=0.001s 2026-04-22 10:31:04 (12.7 MB/s) - 'gpl-3.0.txt' saved [35149]The Content-Encoding: gzip header confirms the transfer was compressed, while the larger saved byte count shows that wget expanded the file back into plain text on disk.
- Confirm that the saved file is ordinary text after the download completes.
$ file gpl-3.0.txt gpl-3.0.txt: ASCII text
- Compare the same URL with compression disabled.
$ wget --compression=none --server-response --output-document=gpl-3.0-plain.txt https://www.gnu.org/licenses/gpl-3.0.txt --2026-04-22 10:31:21-- https://www.gnu.org/licenses/gpl-3.0.txt Resolving www.gnu.org (www.gnu.org)... 209.51.188.116, 2001:470:142:5::116 Connecting to www.gnu.org (www.gnu.org)|209.51.188.116|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Wed, 22 Apr 2026 02:31:22 GMT Server: Apache Strict-Transport-Security: max-age=63072000 X-Frame-Options: sameorigin X-Content-Type-Options: nosniff Access-Control-Allow-Origin: (null) Last-Modified: Sat, 30 Sep 2017 07:16:26 GMT ETag: "894d-55a62eb645dcd" Accept-Ranges: bytes Content-Length: 35149 Vary: Accept-Encoding Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/plain Content-Language: non-html Length: 35149 (34K) [text/plain] Saving to: 'gpl-3.0-plain.txt' 0K .......... .......... .......... .... 100% 149K=0.2s 2026-04-22 10:31:22 (149 KB/s) - 'gpl-3.0-plain.txt' saved [35149/35149]No Content-Encoding header and matching transfer and saved sizes mean the server sent the plain response without gzip compression.
Add --debug when you need to inspect the request itself. Current GNU Wget sends Accept-Encoding: gzip with auto or gzip, and Accept-Encoding: identity with none.
- Remove the temporary files after the test.
$ rm gpl-3.0.txt gpl-3.0-plain.txt
Use --compression=none for archive downloads or checksum comparisons where transparent decompression would change the saved bytes.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
