What Is a .GZ File? (.gz, .tar.gz, .tgz)
A .gz file is a single file compressed with gzip, the GNU compression tool. Most often you will see .tar.gz or .tgz, which is a TAR archive of many files compressed with gzip, the standard way to distribute Linux and open-source software. macOS, Linux and Windows 11 can extract them without extra software.
- Extension
- .gz, .tar.gz, .tgz
- Full name
- Gzip Compressed File
- Type
- Archive file
- MIME type
- application/gzip
- Developed by
- Jean-loup Gailly and Mark Adler (GNU Project)
About GZ files
Gzip compresses exactly one stream of data using the Deflate algorithm, the same method used inside ZIP. It has no concept of folders, so to compress a directory people first bundle it with tar and then gzip the result. That gives .tar.gz, also written .tgz. A lone .gz file, such as access.log.gz or data.csv.gz, decompresses to one file with the .gz removed.
Gzip is everywhere behind the scenes: web servers compress pages with it, log rotation tools gzip old logs, and data exports often arrive as .csv.gz or .json.gz. It is fast and reliable rather than maximally compact; xz and zstd produce smaller files, but gzip remains the most universally supported option on Unix-like systems.
On Windows, people sometimes extract a .tar.gz and find a .tar inside; that is expected, because there are two layers. Tools like 7-Zip show each layer separately, while Windows 11 File Explorer and the tar command handle both at once.
What GZ files are used for
- Source code and software releases (.tar.gz)
- Compressed server logs (access.log.1.gz)
- Large data exports such as .csv.gz and .json.gz
- Backups of website and database files
How to open a .gz file
Mac
Double-click to extract with Archive Utility; a .tar.gz expands straight into a folder.
Windows
Windows 11 File Explorer opens .tar.gz and .tgz files. You can also run tar -xzf file.tar.gz in Command Prompt, or use 7-Zip.
Linux
Run tar -xzf file.tar.gz for archives, or gunzip file.gz for a single compressed file.
Android
Use an archive app such as ZArchiver, which handles both layers.
How to convert a .gz file
To turn a .tar.gz into a ZIP, extract it fully, then compress the folder as ZIP in File Explorer, Finder or 7-Zip.
To create a .tar.gz on Mac or Linux, run tar -czf name.tar.gz foldername; on Windows 10 and 11 the same tar command works in Command Prompt.
To read a compressed log without extracting, use zcat or zless on Mac and Linux.
Changing the extension in the file name does not convert the file. See how to change a file extension for when renaming is safe.
Naming and renaming GZ files
- Keep the inner extension when compressing single files (report.csv.gz, not report.gz) so the format is clear after decompression.
- Use .tar.gz rather than .tgz when sharing with non-technical people; the longer name makes the two layers obvious.
- Log rotation names like app.log.3.gz encode age; do not rename them if a tool or script reads them in sequence.
Renaming lots of .gz files? Use the free online bulk renamer for patterns and numbering, or try File Renamer AI to name each file from what is inside it.
Related file types
A .tar file is a tape archive, a Unix format that bundles many files and folders into one file while preserving names, permissions and timestamps. Plain TAR does not compress; it is usually combined with gzip, bzip2 or xz to make .tar.gz, .tar.bz2 or .tar.xz files. macOS, Linux and Windows 10 and 11 include a tar tool.
A .zip file is a compressed archive that bundles one or more files and folders into a single, smaller file. It uses lossless compression, so everything comes back exactly as it was when you extract it. Windows, macOS, iPhone, Android and Chromebooks all open ZIP files without installing anything.
A .7z file is a compressed archive created with 7-Zip, the free and open-source archiver by Igor Pavlov. It uses LZMA or LZMA2 compression, which usually produces smaller archives than ZIP, and supports AES-256 encryption including hidden file names. Windows 11 opens and creates 7z natively; Macs need a free app.
A .rar file is a compressed archive in the proprietary RAR format created by Eugene Roshal and used by WinRAR. Like ZIP, it bundles files into one smaller package, but adds strong AES-256 encryption, recovery records and easy multi-part splitting. Windows 11 can now extract RAR files natively; creating them still needs WinRAR.
Frequently Asked Questions
How do I open a .tar.gz file on Windows?
On Windows 11, double-click it in File Explorer. On Windows 10, open Command Prompt and run tar -xzf filename.tar.gz, or use 7-Zip.
What is the difference between .gz and .tar.gz?
A .gz holds one compressed file. A .tar.gz is a TAR bundle of many files that has then been compressed with gzip.
Is .tgz the same as .tar.gz?
Yes. .tgz is a shorter spelling of the same format, originally used for systems that limited extension length.