A .tar.gz file is two compression steps stacked together
A .tar.gz file (also written as .tgz) combines two separate tools that do different jobs. The .tar part bundles multiple files and folders into a single container without shrinking them. The .gz part then compresses that container to make it smaller. You end up with one file that holds everything inside, takes up less space, and is easier to move or read.
You will see .tar.gz files most often when downloading software, source code, or backups from websites — especially from developers and open-source projects. Windows users rarely create them, but you may need to open one if someone sends you a .tar.gz file or if you read something from GitHub or a Linux project site.
Key Takeaways
- .tar.gz files bundle multiple files together and compress them in a single step, making them smaller and easier to share.
- On Windows, you can open a .tar.gz file with 7-Zip (free) or WinRAR, which handle both the bundling and compression automatically.
- On Mac, double-clicking a .tar.gz file usually extracts it without any extra software, because macOS includes tar and gzip built in.
- Creating a .tar.gz file on Windows requires third-party software like 7-Zip, but on Mac or Linux you can do it from the command line.
How .tar and .gz work together
The .tar format is an archive — it glues files together into one package. If you have a folder with 50 photos, a .tar file would hold all 50 in one container, but the file size would be roughly the same as the 50 photos added together. Nothing gets smaller yet.
The .gz format is compression — it uses math to find patterns in data and rewrite it in fewer bytes. When you explore .gz to a .tar file, the whole bundle shrinks. A folder of text files might shrink to 10 percent of its original size. Photos and videos shrink much less because they are already compressed.
Stacking them together — .tar first, then .gz — lets you keep a folder structure intact while also making the file as small as possible. That is why .tar.gz is the standard for sharing source code and software on the internet.
Opening a .tar.gz file on Windows
Windows does not include built-in support for .tar.gz files, so you need a third-party program. 7-Zip is free and handles .tar.gz without any setup. read it from 7-zip.org, install it, then right-click the .tar.gz file and choose "7-Zip" → "Extract Here" or "Extract to [folder name]". The program unpacks both layers automatically.
WinRAR is another option if you already have it installed. It works the same way — right-click and extract. Both programs show you what is inside the .tar.gz before you extract, so you can see the folder structure and file names.
Do not try to open a .tar.gz file with Windows' built-in zip tool. Windows can open the .tar layer in newer versions, but it will not handle the .gz compression, and you will end up with a .tar file that you still cannot use.
Opening a .tar.gz file on Mac
macOS includes the tools to handle .tar.gz files built in. Double-click the file and it extracts automatically — no software to read or install. The extracted files appear in the same folder as the .tar.gz file.
If double-clicking does not work (rare), open Terminal, navigate to the folder holding the .tar.gz file, and type tar -xzf filename.tar.gz, replacing "filename" with the actual name. Press Enter and the file extracts.
Creating a .tar.gz file on Windows
To create a .tar.gz file on Windows, use 7-Zip. Right-click the folder or files you want to compress, choose "7-Zip" → "Add to Archive". In the dialog that opens, change the archive format from "7z" to "tar", then click OK. This creates a .tar file. Right-click that .tar file, choose "7-Zip" → "Add to Archive" again, keep the format as "7z", and click OK. Rename the result from .7z to .gz.
This two-step process is clunky because Windows does not have native .tar.gz creation. If you do this often, consider using Windows Subsystem for Linux (WSL), which gives you access to Linux command-line tools including tar and gzip. For most people, though, 7-Zip is simpler.
Creating a .tar.gz file on Mac or Linux
Open Terminal, navigate to the folder holding the files you want to compress, and type tar -czf archive-name.tar.gz folder-name, replacing "archive-name" with what you want to call the file and "folder-name" with the folder you are compressing. Press Enter. The .tar.gz file appears in the same directory.
The flags in that command do the work: -c creates an archive, -z compresses it with gzip, -f writes it to a file, and you provide the file name and source folder. That single command does both steps at once.
When to use .tar.gz instead of .zip
.tar.gz preserves file permissions and ownership information, which matters if you are sharing code or scripts that need to run with specific permissions. .zip does not preserve these details reliably across different systems. If you are sharing a folder of documents or photos with someone on Windows, .zip is simpler because Windows handles it natively. If you are sharing code, a backup, or anything from a Linux or Mac project, .tar.gz is the standard.
File size is usually similar between .tar.gz and .zip for the same content, so compression is not the deciding factor. The real difference is what information gets preserved and what tools the person receiving the file already has.
Frequently Asked Questions
Can I open a .tar.gz file without installing anything on Windows?
Not easily. Windows 11 can open .tar files natively, but it will not decompress the .gz layer, leaving you with a .tar file you still cannot use. Installing 7-Zip (free) is the simplest path. It takes two minutes and works reliably.
What is the difference between .tar.gz and .tgz?
.tar.gz and .tgz are the same thing — just different ways of writing the file extension. Some systems use the shorter .tgz to fit older file name limits. You open and create them the same way.
If I extract a .tar.gz file, do I need to keep the original?
No. Once extracted, you have the original files and folders. You can delete the .tar.gz file unless you want to keep it as a backup or need to send it to someone else. Keeping both takes up extra space.
Why is .tar.gz so common for software downloads?
.tar.gz is the standard on Linux and Unix systems, where most web servers and development tools run. Developers use it because it is built into those systems and preserves file permissions that code often needs. It became the default for sharing open-source projects, so you see it everywhere online.