A .tgz file is a compressed archive that bundles multiple files and folders into one, then shrinks the result to save space

The .tgz format combines two separate compression steps into a single file type. First, a tool called tar packages multiple files and directories into one uncompressed archive. Then gzip compresses that archive down to a smaller size. The result is a single .tgz file (also written as .tar.gz) that contains everything inside, squeezed to roughly one-quarter or one-third of its original size.

You will most often encounter .tgz files when downloading software, source code, or data sets from the internet. Because they are smaller than the original files, they download faster and take up less disk space. Once you have the .tgz file, you extract it — which reverses both compression steps and returns you to the original files and folders inside.

.tgz files are especially common in Linux and Unix environments, though they work on Windows and Mac as well. If you have received a .tgz file and are not sure what to do with it, the answer is almost always to extract it first, then look at what comes out.

Key Takeaways

  • A .tgz file is two compression methods stacked together: tar packages files, then gzip shrinks the result.
  • You extract a .tgz file using built-in tools on Mac and Linux, or free software like 7-Zip or WinRAR on Windows.
  • The extraction process creates a folder or set of files on your computer; the .tgz file itself remains unchanged unless you delete it.
  • You do not need to understand how tar and gzip work separately — treating .tgz as a single format is fine for everyday use.

How to extract a .tgz file on Mac

On Mac, you can extract a .tgz file without installing anything. Double-click the .tgz file in Finder, and the built-in Archive Utility will automatically extract it. A new folder or set of files will appear in the same location as the .tgz file, usually within a few seconds.

If double-clicking does not work, open Terminal (found in Applications > Utilities) and use the command tar -xzf filename.tgz, replacing "filename" with the actual name of your file. This method also works if the file is in a different folder — navigate to that folder in Terminal first, or include the full path to the file.

How to extract a .tgz file on Windows

Windows does not have built-in support for .tgz files, so you will need free software. 7-Zip is the most straightforward option: download it from 7-zip.org, install it, then right-click your .tgz file and select "7-Zip > Extract Here". The extracted files will appear in a new folder in the same location.

WinRAR is another option if you prefer a different interface, though it is not free after a trial period. Both programs handle .tgz files without any extra steps or settings — just extract and the files come out.

If you use Windows 10 or later and prefer not to install software, you can also use Windows Subsystem for Linux (WSL), which gives you access to Linux tools including tar. This is more technical and not necessary for most users, but it is an option if you work with .tgz files regularly.

How to extract a .tgz file on Linux

On Linux, open a terminal and navigate to the folder containing your .tgz file. Then run tar -xzf filename.tgz, replacing "filename" with the actual name. The extracted files will appear in the same folder.

If you prefer a graphical interface, most Linux desktop environments (like Ubuntu's Files app) will let you right-click a .tgz file and extract it directly. The method varies slightly by desktop environment, but the option is usually labeled "Extract" or "Extract Here".

What is inside a .tgz file before you extract it

You cannot easily see what is inside a .tgz file without extracting it first. Unlike a .zip file, which some tools can browse without full extraction, .tgz files are designed to be extracted as a complete unit.

If you want to know what a .tgz file contains before extracting it, you can use the command tar -tzf filename.tgz in Terminal or a Linux command line. This lists the contents without extracting anything. On Windows with 7-Zip, you can also right-click the file and select "7-Zip > Open archive" to browse the contents in a window before extracting.

The difference between .tgz and other compressed file types

.zip files are more common on Windows and Mac for everyday use. They compress files the same way .tgz does, but .zip is a single format rather than two stacked together. Both extract the same way — double-click on Mac, use built-in tools on Windows 10 and later, or use 7-Zip on older Windows versions.

.tar files are the uncompressed version of what is inside a .tgz. A .tar file bundles multiple files into one but does not shrink them. You will rarely encounter a bare .tar file on the internet because .tgz is smaller and serves the same purpose.

.gz files are gzip compression applied to a single file, not a bundle. If you see a .gz file, it usually contains one compressed file inside, whereas .tgz contains many files and folders organized together.

When you might encounter a .tgz file

Software developers often distribute source code as .tgz files, especially for open-source projects. If you download code from GitHub or a similar site, you may see a button that offers to download as .tar.gz — that is a .tgz file.

System administrators and Linux users work with .tgz files regularly for backups, software installation, and data transfer. If you are setting up a server or working in a technical role, you will see them often. For casual computer use, you might encounter one occasionally when downloading tools or data sets.

Frequently Asked Questions

Is it safe to extract a .tgz file from the internet?

Yes, as long as it comes from a source you trust. Extracting a .tgz file does not run any code — it just unpacks the files inside. However, the files that come out could be harmful if they came from an untrusted source, so only extract .tgz files from websites and people you recognize.

Can I delete the .tgz file after extracting it?

Yes. Once you have extracted a .tgz file, the original .tgz file is no longer needed unless you want to keep a backup. Deleting it will not affect the extracted files. If you think you might need the compressed version later, you can keep it, but most people delete it to save disk space.

What if my extracted .tgz file has a folder inside instead of loose files?

That is normal. Many .tgz files are organized so that everything extracts into a single folder. Open that folder and you will find the actual files and subfolders inside. This keeps your downloads organized and prevents files from scattering across your desktop.

Can I create my own .tgz file?

Yes. On Mac and Linux, use the command tar -czf filename.tgz foldername to compress a folder. On Windows, 7-Zip can create .tgz files if you right-click a folder and select "7-Zip > Add to archive", then choose the .tar.gz format. Most people do not need to create .tgz files unless they are distributing software or sharing large amounts of data.