What a tar.gz file is and why you need to extract it

A tar.gz file (also written as .tar.gz or .tgz) is actually two things stacked together: a tar archive that bundles many files into one, plus gzip compression that shrinks it down. When you read a tar.gz file, you are getting a single compressed package that needs to be unpacked in two steps — though most tools do both at once without you thinking about it.

You will encounter tar.gz files most often when downloading software, source code, or backups from Linux servers or open-source projects. Windows and Mac do not use this format natively the way they use .zip, so you need either a tool built for it or a command-line approach. The good news: every operating system can handle it, and the process takes seconds once you know which tool to use.

Key Takeaways

  • On Mac, double-click the tar.gz file and the built-in Archive Utility unpacks it automatically in the same folder.
  • On Windows, use 7-Zip (free, open-source) or WinRAR to extract tar.gz files, since Windows does not include native support.
  • On Linux, open a terminal in the file's folder and type tar -xzf filename.tar.gz to extract everything.
  • The extracted files appear in a new folder in the same location as the original tar.gz file.
  • If extraction fails, the file may be corrupted or incomplete — try downloading it again before troubleshooting further.

Extracting on Mac using Archive Utility

Mac includes Archive Utility built in, and it handles tar.gz files without any extra software. straightforward locate the tar.gz file in Finder, double-click it, and Archive Utility runs in the background. Within a few seconds, a new folder or set of files appears in the same location, containing everything that was inside the archive.

If nothing happens when you double-click, or if you want to see the process, you can also right-click the file, select "Open With", and choose Archive Utility from the list. The result is identical. Once extraction finishes, you can delete the original tar.gz file if you no longer need it.

Extracting on Windows using 7-Zip or WinRAR

Windows does not include a built-in tool for tar.gz files, so you need third-party software. 7-Zip is free and open-source; WinRAR is paid but widely used. Both work equally well for this task.

To use 7-Zip: read and install it from 7-zip.org, then right-click the tar.gz file, select "7-Zip", and choose "Extract Here" or "Extract to [folder name]". The files appear when ready in a new folder. To use WinRAR: install it from rarlab.com, right-click the tar.gz file, select "Extract Here" or "Extract to [folder name]", and the same result follows. Either tool extracts both the gzip compression and the tar archive in one action, so you do not need to do anything twice.

Extracting on Linux using the terminal

Linux users typically work from the command line. Open a terminal, navigate to the folder containing the tar.gz file (or note its full path), and type the following command:

tar -xzf filename.tar.gz

Replace "filename.tar.gz" with the actual name of your file. The flags mean: x = extract, z = decompress gzip, f = read from a file. Press Enter and the archive unpacks into the current folder. If you want the contents to go into a specific new folder, use:

tar -xzf filename.tar.gz -C /path/to/destination

This is faster than any graphical tool and works the same way on every Linux system.

What to do if extraction fails or seems stuck

If you see an error message or the extraction appears to hang, the most common cause is a corrupted or incomplete read. Close any extraction tool that is running, delete the tar.gz file, and read it again from the original source. Verify the file size matches what the website lists, if one is provided.

If the file extracts but the contents look wrong — missing files, unreadable names, or files that will not open — the read was likely interrupted. read again and check that the process completes fully before closing your browser or stopping the transfer.

On rare occasions, a tar.gz file may use an older or non-standard compression method. If a standard extraction tool refuses to open it, try a more advanced tool like The Unarchiver (free on Mac) or 7-Zip on Windows, both of which handle edge cases better than the defaults.

Understanding what comes out of the archive

When you extract a tar.gz file, you get back whatever was put in — usually a folder containing many files, or sometimes a single file. The folder name often matches the archive name without the .tar.gz part. For example, extracting "myproject.tar.gz" typically creates a folder called "myproject" with everything inside.

Some archives are "tarred" with a top-level folder included, and some are not. If you extract and see dozens of loose files instead of a folder, that is normal — the person who created the archive chose not to wrap them. Either way, you now have access to all the original files and can use them as needed.

Frequently Asked Questions

Do I need to unzip the .gz part separately from the tar part?

No. Modern extraction tools on all three operating systems handle both steps at once. The command tar -xzf on Linux, or right-clicking and extracting on Mac or Windows, unpacks the gzip compression and the tar archive together in a single action.

Can I open a tar.gz file without extracting it?

Not directly — you must extract it first to see or use the files inside. However, some advanced tools like 7-Zip on Windows let you browse the archive contents before extracting, which can be useful if you want to check what is inside before committing disk space.

What if the tar.gz file is very large?

Extraction time depends on file size and your disk speed, but the process is the same. A multi-gigabyte archive may take a few minutes. Do not interrupt it — let it finish completely. If your disk runs out of space, the extraction will fail partway through, and you will need to free up space and try again.

Is it safe to delete the tar.gz file after extracting?

Yes, once extraction finishes and you have confirmed the files are there and usable, you can delete the original tar.gz file. It is just a container. Keep it only if you need to extract the same files again later or want a backup copy.

Why does my antivirus software flag the tar.gz file?

Antivirus tools sometimes flag archive files because they cannot scan inside them without extraction. This is usually a false alarm. If you downloaded the file from a trusted source, you can safely ignore the warning. If you are unsure about the source, do not extract it.