File Extension File Extension Guide

What is a GZ File?Gzip

A technical reference for the .gz extension, a file compressed with gzip. What a GZ file is, why it holds just one file, how it teams up with TAR to make a .tar.gz, and how to open and extract one on Linux, Mac or Windows.

Compressed File 🐧 Unix and Linux 🗜️ Lossless 📄 One File
.GZ

Gzip Compressed File

Type:Compressed file
Extension:.gz
Holds:One file or stream
Made by:gzip utility
Home turf:Unix and Linux

📖 What is a GZ File?

A GZ file is a file that has been compressed with gzip, the standard compression tool on Unix and Linux systems. It uses the .gz extension, and it shrinks a file so it takes up less room and travels faster, with nothing lost along the way.

The important quirk is that gzip works on a single file at a time. A GZ file wraps one file, or one stream of data, and squeezes it down. It is not a container for a whole folder of things, which is where it differs most from the ZIP files people know from Windows.

Because the squeeze is lossless, unpacking a GZ gives you back the exact original, byte for byte. That reliability, plus its speed, is why gzip became the go-to way to compress logs, downloads and web traffic across the Unix world and beyond.

Key Characteristics

  • A compressed file, made smaller by gzip
  • Holds one file, not a folder of many
  • Lossless, the original comes back whole
  • A Unix staple, built into Linux and Mac

Good to Know

  • Teams up with TAR, to make a .tar.gz
  • Uses DEFLATE, the same core as ZIP
  • Keeps a checksum, to catch corruption
  • Powers the web, in gzip page delivery
💡 Why it matters: Knowing a GZ holds just one file explains a lot, why you so often see .tar.gz rather than plain .gz, and why extracting one usually hands you back a single file rather than a folder of them.

⚡ Quick Facts

File Extension.gz
Full NameGzip Compressed File
CategoryCompressed file
Made WithThe gzip utility
HoldsA single file or data stream
CompressionDEFLATE, lossless
Created1992, by Gailly and Adler
StandardRFC 1952
MIME Typeapplication/gzip
Related Extensions.tar.gz, .tgz, .tar, .zip

📄 Why Just One File

The single most useful thing to grasp about gzip is that it compresses, but it does not gather. It takes one file and makes it smaller, and that is the whole job.

💡 Compressing is not bundling: gzip only squeezes. It has no notion of packing several files or a folder into one place. That gathering job belongs to a separate tool, TAR, which is why the two are so often used as a pair.

This is a deliberate design from the Unix world, where small tools each do one thing well and combine cleanly. So when you have many files to compress, you first gather them with TAR into one bundle, then hand that bundle to gzip. The result is the familiar .tar.gz.

🔤 GZ vs tar.gz

Most GZ files you meet in the wild are actually .tar.gz files, and the difference trips people up. It comes down to layers.

Point.gz.tar.gz
Holds many files no yes
Layers involvedgzip onlyTAR then gzip
Keeps folder structure no yes
Also written as.gz.tgz

A plain .gz is one compressed file. A .tar.gz, also written .tgz and nicknamed a tarball, is a TAR bundle of many files that has then been gzip-compressed as a whole. Unpacking a .tar.gz gives back the full set of files and folders, while unpacking a plain .gz gives back its single file.

Two tools, two jobs, one .tar.gz many files TAR archive.tar one bundle, not smaller TAR gathers gzip archive.tar.gz bundled and shrunk gzip shrinks a plain .gz skips the TAR step, just one file shrunk gzip only ever compresses one thing, so TAR bundles first when there are many

🆚 GZ vs ZIP

GZ and ZIP both shrink data, and they even share the same underlying compression method, yet they are built around different ideas.

GZ, the Unix way

  • Compresses one file, and leaves bundling to TAR
  • Squeezes related files together for a tighter result
  • The native choice on Linux and Mac

ZIP, the all-in-one

  • Bundles and compresses many files by itself
  • Compresses each file on its own inside the archive
  • The native choice on Windows
💡 The tidy summary: ZIP is one tool that both gathers and compresses. GZ splits those jobs, letting TAR gather and gzip compress. That split is why a .tar.gz can often pack related files a little tighter than the ZIP equivalent.

📂 How to Open a GZ File

Opening a GZ means decompressing it to get the file inside. Every system can do it, though the built-in help differs.

1

Linux and Mac

Both have gzip built in. A double-click in the file manager usually unpacks a GZ, or a short terminal command does it.

2

Windows

Recent Windows can handle GZ from the command line, and free tools like 7-Zip or PeaZip open one with a right-click.

3

In a browser

Online decompressors unpack a GZ without installing anything, handy for a quick one-off on any device.

💡 One file in, one file out: Decompressing a plain .gz gives you back the single file it held, often with the same name minus the .gz. A .tar.gz needs one more step to unpack the TAR bundle inside.

🗜️ Extracting on Each System

If you prefer the command line, or you are on a server, a couple of short commands cover almost every case. Here are the common ones.

Unpack a single .gz file

$ gunzip file.gz          # or: gzip -d file.gz

Unpack a .tar.gz bundle

$ tar -xvzf archive.tar.gz  # extract everything inside

On Windows the same tar command works in a recent Command Prompt or PowerShell. If you would rather click than type, 7-Zip and PeaZip extract both a plain .gz and a .tar.gz from the right-click menu.

⚠️ Two layers, two steps: With some tools a .tar.gz unpacks in one go, but with others you decompress the gzip layer first and then open the TAR. The single tar command above rolls both steps into one.

👀 Peeking Inside Without Extracting

Sometimes you only need to read a compressed text file, a rotated log say, not unpack it to disk. On Linux and Mac a family of Z commands reads gzip text on the fly, which saves both time and space.

Read, page or search a .gz without unpacking it

$ zcat access.log.gz       # print the whole thing
$ zless access.log.gz      # page through it
$ zgrep error access.log.gz # search inside it

These mirror the everyday cat, less and grep commands, but they decompress the file in memory as they go and leave the .gz untouched on disk. For anyone sifting through gzipped server logs, they are the quickest way in.

💡 Keep the original when you do extract: gzip removes the .gz once it decompresses, which surprises people. Adding the keep flag, as in gunzip -k file.gz or gzip -dk file.gz, leaves the compressed copy in place alongside the result.
Read it, or unpack it a .gz file just read it zcat, zless, zgrep, nothing left on disk unpack it gunzip or tar writes out the real file peeking saves disk space, extracting gives you the file to keep

🎯 Where GZ Is Used

Gzip turns up all over computing, usually quietly in the background, wherever data needs to be smaller.

Web

Web Pages

Servers gzip pages before sending them, so they arrive faster, and your browser unpacks them unseen.

Logs

Log Files

Servers compress old logs into .gz to save space, leaving files like access.log.gz.

Software

Software

Source code and Linux packages ship as .tar.gz, a compact way to hand over many files.

Backups

Backups

Database dumps and backups are often gzipped, shrinking a large file for storage or transfer.

🛠️ If It Will Not Open

A GZ that refuses to unpack usually points to one of a few familiar causes.

Broken downloadgzip keeps a checksum, so a file cut short mid-download fails its integrity check. Download it again from the source.
No suitable toolOn older Windows without a built-in option, install a free extractor such as 7-Zip or PeaZip and try again.
Only the gzip layer openedWith a .tar.gz you may be left with a .tar. That is normal, just open the TAR to reach the files.
Renamed extensionA file wrongly renamed to .gz was never gzip data. Restore the correct extension to open it properly. Note too that simply deleting the .gz from a name does not decompress a real gzip file, you still need a tool to unpack it.

🔀 Related Formats

GZ sits among the compression and archive formats you meet alongside it.

.tar.gzA TAR bundle of many files compressed with gzip, the usual way to ship a set of files on Unix.
.tgzThe same thing as .tar.gz, just written with a shorter single extension.
.tarAn uncompressed bundle of files, the tarball that gzip is often used to shrink.
.zipThe all-in-one archive that both bundles and compresses, common on Windows.
.bz2Another single-file compressor, often paired with TAR as .tar.bz2 for tighter results.

❓ Frequently Asked Questions

Opening a GZ means decompressing it to get the file inside. On Linux and Mac, gzip is built in, so a double-click in the file manager usually unpacks it, or a short terminal command does the job. On Windows, a recent version handles GZ from the command line, and free tools like 7-Zip or PeaZip open one with a right-click. Online decompressors also work without installing anything. A plain .gz gives back one file.

A GZ file is a file compressed with gzip, the standard compression tool on Unix and Linux systems. It uses the .gz extension and makes a file smaller for storage or transfer, with nothing lost, so you get the exact original back. The key quirk is that gzip handles just one file at a time. To compress many files, they are first bundled with TAR, which produces the familiar .tar.gz you see so often.

A plain .gz is a single file compressed with gzip. A .tar.gz is a two-layer format, a TAR bundle of many files that has then been gzip-compressed as a whole. Because gzip alone only compresses one file, TAR does the job of gathering many files and folders into one, and gzip shrinks that bundle. Unpacking a .tar.gz returns the whole set of files, while a plain .gz returns just its single file.

On Linux, Mac or a recent Windows, one command does it all, tar -xvzf archive.tar.gz, which unpacks the gzip layer and the TAR bundle in a single step and drops the files into the current folder. If you prefer clicking, 7-Zip or PeaZip extract a .tar.gz from the right-click menu, though some tools do it in two passes, first the .gz, then the .tar inside. Either way you end up with the original files and folders.

By design. gzip comes from the Unix tradition of small tools that each do one thing well, and its one job is compression, not gathering. It has no notion of packing several files or a folder together. That gathering task belongs to TAR, a separate tool, which is why the two are so often paired as .tar.gz. Splitting the roles keeps each tool simple and lets them combine cleanly.

Yes. Recent versions of Windows include the tar command, so you can extract a .gz or .tar.gz from Command Prompt or PowerShell. For a friendlier route, free tools such as 7-Zip and PeaZip open and extract GZ files straight from the right-click menu. Online decompressors work too, unpacking a GZ in the browser with nothing to install. So even though GZ comes from the Unix world, Windows handles it comfortably.

Not quite, though they overlap. Both compress data and even share the same underlying DEFLATE method, but they are built differently. ZIP is one tool that both bundles many files and compresses them, and it is the native choice on Windows. GZ compresses a single file and leaves the bundling to TAR, and it is native to Unix and Linux. A .tar.gz can often pack related files a little tighter than the ZIP equivalent.

There is no direct switch, since the two are built differently. Instead, decompress the GZ first to get the original file or files back, then compress those into a ZIP. On any system you can extract the .gz or .tar.gz, then select the results and create a ZIP from them, on Windows with a right-click Send to compressed folder, or with a tool like 7-Zip. The middle step is always to unpack, then repack.

gunzip is the command that decompresses a gzip file, undoing what gzip did. Running gunzip file.gz restores the original file and, by default, removes the .gz version. It is the same as typing gzip -d, the decompress option. gunzip handles a plain .gz, giving back the single file inside. For a .tar.gz you would usually use the tar command instead, which unpacks the gzip layer and the bundle together.

No. Gzip compression is lossless, so decompressing a GZ gives back the exact original file, byte for byte, with nothing changed or removed. It works by finding repeated patterns in the data and storing them more compactly, then restoring them perfectly on the way out. This makes it safe for anything, source code, documents, logs or backups, where losing even a single byte would matter. The saving is in size alone.

On Linux and Mac, the built-in gzip and tar tools open GZ files, and the graphical file manager usually unpacks one on a double-click. On Windows, the built-in tar command works, and free tools such as 7-Zip, PeaZip and WinRAR open GZ and .tar.gz files from the right-click menu. Online decompressors handle them in a browser too. For servers and scripting, the command-line tools are the fastest and most reliable choice.

That is normal and expected. A .tar.gz has two layers, and some tools peel off only the gzip layer first, leaving the TAR bundle behind as a .tar file. Simply open that .tar to reach the actual files and folders inside. To do both layers at once, use the tar -xvzf command, which decompresses and unpacks the bundle in a single step, so you go straight to the files.

A GZ file is just compressed data, so the file itself is not inherently risky, and gzip keeps a checksum that flags a corrupted or incomplete one. The usual care applies to what is inside, since a compressed file can hold anything, including something unwanted from an unknown source. Extract a GZ from a sender you do not know into a separate folder and check the contents before running or opening them.

On Linux or Mac, run gzip file to compress a single file, which replaces it with a .gz version. To compress many files, first bundle them with TAR and gzip the bundle, or do both at once with tar -czvf archive.tar.gz folder. On Windows, the tar command works the same way in a recent shell, and tools like 7-Zip can create GZ and .tar.gz archives through their interface if you prefer clicking.

On Linux and Mac, the Z commands read gzip text on the fly without unpacking it to disk. Use zcat file.gz to print the contents, zless file.gz to page through them, and zgrep pattern file.gz to search inside. They work just like cat, less and grep, but decompress in memory and leave the .gz untouched. This is the fastest way to check a rotated log or a large compressed text file without using extra space.

By default gzip removes the .gz once it decompresses, which catches people out. To keep the compressed copy, add the keep flag, running gunzip -k file.gz or gzip -dk file.gz, and both the .gz and the extracted file remain. You can also send the output elsewhere with gzip -c, which writes the result to a chosen file and leaves the original in place. Graphical tools like 7-Zip keep the source by default when they extract.

A .log.gz is just a log file compressed with gzip, so extract it and read the log inside. On Windows, open it with 7-Zip from the right-click menu, or run tar in a recent Command Prompt. If you work with these often, the Windows Subsystem for Linux, or WSL, gives you gunzip and the zcat family, letting you read a gzipped log directly. Removing the .gz from the name alone does not decompress it, you still need a tool.

📝 Summary

A GZ file is a single file compressed with gzip, the standard compression tool on Unix and Linux systems. Its defining trait is that it holds just one file, because gzip compresses but does not bundle. To package many files, they are first gathered with TAR into a tarball, then gzip-compressed, giving the familiar .tar.gz, also written .tgz. The compression is lossless, so unpacking returns the exact original, and it uses the same DEFLATE method at its core as ZIP, with a checksum to catch corruption. You open a GZ by decompressing it, with built-in tools on Linux and Mac, the tar command or free tools like 7-Zip on Windows, or an online decompressor. A plain .gz gives back one file, while a .tar.gz gives back a whole set. Gzip is everywhere in quiet ways, compressing web pages, rotated log files, software downloads and backups.