A tar.gz file is a compressed folder that bundles multiple files and folders into a single package
A tar.gz file (also written as .tar.gz or .tgz) combines two separate compression steps into one. First, a tool called tar groups many files and folders into a single archive without shrinking them. Then gzip compresses that archive to make it smaller. The result is a single file that takes up less disk space and is easier to download or email than the original folder would be.
You will most often encounter tar.gz files when downloading software, source code, or backups from Linux and Mac systems. Windows does not use this format natively, though modern versions of Windows 10 and 11 can open them without extra software. On Mac and Linux, the tools to open tar.gz files are built in.
Key Takeaways
- A tar.gz file is a folder compressed twice — once by tar (which bundles files) and once by gzip (which shrinks the bundle).
- On Windows 10 and 11, right-click the file and choose Extract All to open it without downloading anything extra.
- On Mac, double-click the tar.gz file and it will automatically extract in the same folder.
- On Linux, use the command tar -xzf filename.tar.gz in the terminal to extract the contents.
- After extraction, you will have a folder with the original files inside — the tar.gz file itself can then be deleted.
How tar and gzip work together
The tar part of the name stands for "tape archive." Originally, tar was designed to write files to magnetic tape for backup. Over time, it became the standard way to bundle files on Unix and Linux systems. Tar does not compress — it simply groups files and preserves their folder structure so that when you extract them, everything comes back in the same arrangement.
Gzip is the compression layer. It takes the tar bundle and squeezes it down, similar to how a ZIP file works on Windows. The two tools are almost always used together, which is why you see the .tar.gz extension. Some older systems use .tar.Z (with a different compression method) or just .tar (no compression), but tar.gz is by far the most common.
Opening a tar.gz file on Windows
Windows 10 and later versions have built-in support for tar.gz files. Right-click the tar.gz file, select Extract All, and choose where you want the folder to go. Windows will handle both the decompression and the unbundling in one step. The extracted folder will appear in the location you chose.
If you are using an older version of Windows or prefer a graphical tool, you can download 7-Zip (free) or WinRAR (paid). Both programs recognize tar.gz files and will extract them the same way — right-click, extract, choose a location.
Opening a tar.gz file on Mac
On Mac, simply double-click the tar.gz file. The Archive Utility application (built into macOS) will automatically extract it in the same folder. You will see a new folder appear with the contents inside. The original tar.gz file remains on your disk and can be deleted once you have confirmed the extraction worked.
If double-clicking does not work, open Terminal, navigate to the folder containing the tar.gz file, and type tar -xzf filename.tar.gz (replacing filename with the actual name). Press Enter and the extraction will complete in seconds.
Opening a tar.gz file on Linux
Linux users will almost always work with tar.gz files from the command line. Open a terminal, navigate to the folder where the tar.gz file is located, and run tar -xzf filename.tar.gz. The flags mean: x (extract), z (decompress with gzip), and f (read from a file). The extracted folder will appear in the same directory.
If you want to extract the contents into a different folder, add -C /path/to/folder to the end of the command. For example, tar -xzf filename.tar.gz -C ~/Downloads will extract everything into your Downloads folder.
When you might encounter a tar.gz file
Tar.gz files are standard for distributing software and source code on Linux and Mac. If you download a program from GitHub, SourceForge, or a Linux project website, it will often come as a tar.gz archive. System administrators use them for backups and for moving large sets of files between servers.
You are unlikely to see tar.gz files in everyday consumer software on Windows — most Windows programs use .exe installers or .zip files instead. But if you work with open-source software, web development, or system administration, you will encounter them regularly.
What to do after extraction
Once you have extracted a tar.gz file, you will have a folder containing the original files and subfolders. What you do next depends on what is inside. If it is source code, you may need to compile it or follow a README file for installation instructions. If it is a backup, you can browse the files and copy what you need. If it is a program, look for an installer script or executable file inside.
The tar.gz file itself is no longer needed after extraction and can be deleted to save disk space. Keep it only if you want a backup copy of the original compressed archive.
Frequently Asked Questions
Is a tar.gz file the same as a ZIP file?
Both are compressed archives, but they work differently. ZIP is primarily a Windows format and compresses each file individually before bundling them. Tar.gz bundles files first, then compresses the entire bundle. On Mac and Linux, tar.gz is the standard; on Windows, ZIP is more common. Most modern systems can open both.
Can I open a tar.gz file without extracting it?
Some file managers and archive tools let you browse the contents of a tar.gz file without fully extracting it, similar to how you can peek inside a ZIP file. However, to actually use the files inside, you must extract them first.
What if extraction fails or the file is corrupted?
A corrupted tar.gz file will usually show an error message during extraction. If this happens, try downloading the file again — it may have been damaged during transfer. If the problem persists, check that you are using the correct extraction tool for your operating system.
Do I need to install anything to open a tar.gz file?
On Mac and Linux, no — the tools are built in. On Windows 10 and 11, no — Windows handles it natively. On older Windows versions, you will need to download free software like 7-Zip or WinRAR.