A .tgz file is a compressed archive that bundles multiple files and folders into one smaller package
A .tgz file (also written as .tar.gz) is two things happening at once: first, multiple files get bundled together into a single container using a tool called tar, then that container gets compressed to make it smaller using gzip compression. The result is a single file that's easier to download, email, or store than the original collection of files would be.
You'll see .tgz files most often when downloading software, source code, or data archives from websites — especially on Linux and Mac systems, though they work on Windows too. When you open one, you get back all the original files and folders inside, exactly as they were before someone compressed them.
Key Takeaways
- A .tgz file combines multiple files into one container and then compresses it, making it smaller and easier to move around.
- On Mac and Linux, you can usually double-click a .tgz file to extract it automatically; on Windows, you may need third-party software like 7-Zip or WinRAR.
- The file extension .tgz and .tar.gz mean exactly the same thing — they're just two ways of writing it.
- Extracting a .tgz file does not delete the original compressed file; both the archive and the extracted contents will exist on your computer afterward.
How to open a .tgz file on Mac
On macOS, opening a .tgz file is the simplest process. Double-click the .tgz file in Finder, and macOS automatically extracts it using the built-in Archive Utility. The extracted files appear in the same folder as the original .tgz file, usually within a few seconds.
If double-clicking doesn't work, or if you want more control over where the files go, you can use the Terminal. Open Terminal (found in Applications > Utilities), navigate to the folder containing your .tgz file, and type tar -xzf filename.tgz (replacing "filename" with the actual name of your file). Press Enter, and the extraction happens in that same folder.
How to open a .tgz file on Linux
Linux systems treat .tgz files as native, so extraction is straightforward. Open a terminal, navigate to the folder containing your .tgz file, and type tar -xzf filename.tgz. The files extract into the current directory.
If you want to extract the files into a specific folder instead, type tar -xzf filename.tgz -C /path/to/destination, replacing the path with where you want the files to go. This keeps your current folder cleaner if you're working with many archives.
How to open a .tgz file on Windows
Windows doesn't have built-in support for .tgz files, so you'll need third-party software. The most common options are 7-Zip (free and open-source), WinRAR (paid but widely used), or the newer Windows built-in support in some versions. Download and install one of these programs, then right-click the .tgz file, select "Extract" or "Open with," and choose your extraction tool.
If you prefer the command line, Windows 10 and later include tar support in PowerShell. Open PowerShell as Administrator, navigate to your file's folder, and type tar -xzf filename.tgz. This works the same way as on Linux and Mac.
What's inside a .tgz file before you extract it
You can peek inside a .tgz file without fully extracting it, which is useful if you want to see what you're about to unpack. On Mac or Linux, type tar -tzf filename.tgz in Terminal to list all the files and folders inside. On Windows with 7-Zip, right-click the file and select "7-Zip > Open archive" to browse the contents in a window.
This preview is especially helpful when downloading archives from the internet, because you can confirm the folder structure and file names before extraction creates them on your computer. Some archives extract into a single folder, while others dump all files directly into your current directory — knowing which one you're dealing with saves cleanup work.
The difference between .tgz and other compressed file types
You might also encounter .zip, .rar, .7z, or .tar files. The main difference is that .tgz uses gzip compression specifically, while .zip is more common on Windows and works on all systems. A plain .tar file is a bundle without compression — it's larger but doesn't need decompression, just extraction. A .rar file is proprietary and usually requires WinRAR to open.
For most everyday purposes, .zip and .tgz are interchangeable — both compress files and work across operating systems. You'll see .tgz more often in technical communities and on Linux systems, while .zip dominates in general consumer software. If someone sends you a .tgz file, it's usually because they're working in a technical environment or distributing software meant for Linux or Mac.
Why files get packaged as .tgz instead of staying separate
Compressing files into a .tgz archive serves three practical purposes: it makes the total file size smaller (sometimes by half or more, depending on what's inside), it keeps related files bundled together so nothing gets lost during download or transfer, and it preserves folder structure and file permissions — important for software and scripts that need to run correctly.
When you download a software package or source code from a repository, the developer packages it as .tgz to make the download faster and to ensure you get every file in the right place. Extracting it recreates the exact folder layout the developer intended, which matters when files reference each other by location.
Frequently Asked Questions
Do I need to delete the .tgz file after extracting it?
No. Extracting a .tgz file leaves the original archive untouched — both the compressed file and the extracted contents exist on your computer afterward. You can delete the .tgz file if you want to save space, but you don't have to. Keep it if you might need to extract it again later or share it with someone else.
What if the .tgz file won't extract?
The file might be corrupted, incomplete, or downloaded incorrectly. Try downloading it again from the source. If it still won't open, check that you're using the right tool for your operating system — Windows needs 7-Zip or WinRAR, not the built-in extractor. You can also try opening it with a different program to see if one tool works better than another.
Can I create my own .tgz file?
Yes. On Mac or Linux, open Terminal, navigate to the folder containing the files you want to compress, and type tar -czf archive-name.tgz folder-name (replacing the names with your actual folder and desired archive name). On Windows, use 7-Zip or WinRAR to create the archive, or use PowerShell with the same tar command if you're on Windows 10 or later.
Is a .tgz file safe to open?
A .tgz file itself is just a container — safety depends on what's inside and where it came from. Only extract archives from sources you trust. Malicious software can be packaged in a .tgz file just like any other format, so use the same judgment you would with any download from the internet.