UtilityNest

Create GZ File

GZIP-compress a file in your browser and see exactly how much smaller it gets. Add several files or a folder and you get a .tar.gz instead.

How to use Create GZ File

  1. 1Drop one file to create file.gz, or several files or a folder to create a .tar.gz.
  2. 2Set the compression level from 1 (fastest) to 9 (smallest). Level 6 matches the gzip command default.
  3. 3Click Create, check the original size, compressed size and percentage saved, then click Download.

Good uses for GZIP

GZIP is a good fit for shrinking log files, CSV exports, JSON and SQL dumps before you email or upload them; text often compresses to 10 to 30 percent of its size. It also prepares pre-compressed .gz files for web servers and CDNs, and meets upload forms that require .gz data files.

Images, videos, PDFs and ZIP files are already compressed, and GZIP barely changes them. The tool points this out when it sees such files.

Compatible output

The .gz files are standard GZIP and open with gunzip, 7-Zip, macOS Archive Utility and this site's Extract GZ tool. For a single file, the original file name and modified time are stored inside the GZIP header, so gunzip -N restores the right name even if the .gz is renamed.

Privacy and limits

Compression runs in your browser and nothing is uploaded. The file is compressed in memory, so very large files (several hundred MB and up) depend on your device and take longer at level 9.

Levels 1, 6 and 9 on a 100 MB log

We compressed a 104.9 MB web server access log at three levels on a laptop, and again with Chrome's CPU slowed four times to imitate a phone:

Level.gz sizeLaptopPhone-like
1 (fastest)12.76 MB2.7 s7.0 s
6 (default)10.17 MB6.1 s14.5 s
9 (smallest)9.40 MB7.4 s

Level 6 produced a file of exactly the same size, to the byte, as the gzip -6 command on Linux, so the output is standard. A 31.5 MB CSV export went to 10.41 MB at level 6. Level 1 is a sensible choice on a phone when the file only has to fit a limit with room to spare.

Pre-compressed files for a website

Web servers can send a ready-made .gz instead of compressing the same file for every visitor. With nginx's gzip_static on;, a request for app.js is answered with app.js.gz when it exists next to it. Use level 9 for these files: you compress once and every visitor gets the smaller version. Keep the original file too, for the few clients that do not accept compressed responses. Files made here keep their original name inside the GZIP header, so nothing breaks if you rename them.

.gz, .zip or .7z for sending data

  • .gz for one big text file going to a developer, a database or a data portal that asks for it.
  • .zip for anything going to an ordinary user: it opens with a double click on Windows and Mac. Create ZIP handles that.
  • .7z gives the smallest result for text (in our test, logs and CSV were 33% smaller than ZIP) but the recipient needs 7-Zip or a similar tool.

Checking the .gz on the other side

Whoever receives the file can test and read it without unpacking everything:

  • gzip -t data.csv.gz checks the built-in checksum and prints nothing if the file is intact.
  • zcat access.log.gz | head shows the first lines (on a Mac, use gzcat).
  • gunzip -k data.csv.gz unpacks it and keeps the .gz.

Many data tools read .gz directly, so the recipient may not need to unpack at all. Python's pandas, for example, opens sales.csv.gz with a plain read_csv, and zgrep searches compressed logs on Linux.

Frequently asked questions

How do I compress a file to .gz?

Drop the file here, keep level 6 or choose another level, click Create, then Download.

Can a GZ file contain several files?

GZIP compresses one file. When you add several files, this tool bundles them with TAR first and gives you a .tar.gz.

Which compression level should I use?

Level 6 is a good balance. Level 9 is a few percent smaller but slower; level 1 is fastest.

Is GZ better than ZIP?

Compression is similar. ZIP is easier to open on Windows; GZ and TAR.GZ are the norm on Linux, servers and the web.

Does GZIP keep the original file name?

Yes, for a single file the original name and modified time are stored in the GZIP header, and the download is named file.ext.gz.

Is level 9 worth the wait?

For files you compress once and serve many times, yes. For a one-off email, level 6 is close: on our 104.9 MB log, level 9 was 7.6% smaller than level 6 and took 21% longer.

Can I compress on my phone?

Yes. In our phone-like test, the 104.9 MB log took 14.5 s at level 6 and 7.0 s at level 1. Larger files depend on how much memory the browser gives the tab.

Will Windows open a .gz file?

Not with a double click on most PCs. 7-Zip opens .gz files on any Windows version, a Mac opens them in Finder, and this site's Extract GZ tool works everywhere. For recipients who are not technical, a ZIP is still easier.

Can I gzip a whole folder?

Yes. Add the folder or several files, and the tool bundles them with TAR first and gives you a .tar.gz, because GZIP itself holds only one file.