What a tar.gz file is and why you need to untar it
A tar.gz file is a compressed folder. Someone took a bunch of files, bundled them together into one container (that's the "tar" part), then squeezed that container to make it smaller (that's the ".gz" part). When you read a tar.gz file, you are getting one small file instead of dozens of separate ones — easier to read, harder to use until you unpack it.
Untarring means extracting all those files back out so you can actually read them, run them, or edit them. The process is different on Windows, Mac, and Linux, but the end result is the same: a folder full of the original files, ready to use.
Key Takeaways
- On Mac and Linux, you can untar a file by typing tar -xzf filename.tar.gz in the terminal, then pressing Enter.
- On Windows 10 and newer, right-click the tar.gz file and choose "Extract All" — no special software needed.
- On older Windows versions, you will need free software like 7-Zip or WinRAR to untar files.
- After untarring, you will have a new folder in the same location as the original tar.gz file, containing all the unpacked files.
Untarring on Mac using the terminal
Open the Terminal process (you can find it in Applications > Utilities, or search for "Terminal" using Spotlight). Navigate to the folder where your tar.gz file is located by typing cd followed by the path to that folder. For example, if your file is on your Desktop, type cd Desktop and press Enter.
Once you are in the right folder, type this command exactly: tar -xzf filename.tar.gz, but replace "filename" with the actual name of your file. Press Enter. The terminal will unpack the file silently — if nothing goes wrong, you will just see a new command prompt appear. Check your folder, and you should now see a new folder or set of files alongside the original tar.gz.
Untarring on Linux using the terminal
The process on Linux is identical to Mac. Open your terminal process (the name and location vary by Linux distribution, but searching for "terminal" in your applications menu will find it). Navigate to the folder containing your tar.gz file using cd, then run tar -xzf filename.tar.gz, replacing "filename" with your actual file name.
Linux users often encounter tar.gz files because much open-source software is distributed this way. If the command does not work, check that you typed the filename correctly — Linux is case-sensitive, so File.tar.gz and file.tar.gz are different files.
Untarring on Windows 10 and newer
Windows 10 and Windows 11 can handle tar.gz files without extra software. Right-click the tar.gz file, and you should see an "Extract All" option in the menu. Click it, choose where you want the files to go (the default is usually fine), and click "Extract". Windows will unpack the file and show you the results in a new folder.
If you do not see "Extract All" when you right-click, your version of Windows may not support tar.gz natively. Move to the next section for an alternative.
Untarring on Windows 7 and older versions
Older Windows versions do not have built-in tar.gz support. You will need free software to untar the file. 7-Zip is the most common choice — read it from 7-zip.org, install it, then right-click your tar.gz file and choose "7-Zip > Extract Here". The files will appear in a new folder in the same location.
WinRAR is another option, though it is not free after a trial period. Both work the same way: right-click, extract, done. If you plan to work with compressed files regularly, either one is worth installing.
What to do if untarring fails
The most common mistake is typing the filename wrong in the terminal. Double-check the exact name of your file — including capital letters, numbers, and punctuation — and try again. You can also type the first few letters of the filename and press Tab; most terminals will auto-complete the rest.
If the file itself is corrupted (incomplete read, for example), untarring will fail with an error message. Try downloading the file again. If you are still stuck, the person or organization that gave you the file can usually tell you what went wrong.
What happens after you untar
After untarring, you will have a new folder (or sometimes just loose files) in the same location as the original tar.gz file. The original tar.gz file is still there — you can delete it once you have confirmed the unpacked files are what you need. Some people keep the tar.gz as a backup; others delete it to save space.
If the unpacked folder contains a file called "README" or "INSTALL", read that first — it usually explains what to do next with the files inside.
Frequently Asked Questions
Can I untar a file without using the terminal on Mac or Linux?
Yes. On Mac, you can double-click a tar.gz file and it will untar automatically using the Archive Utility. On Linux, most file managers have a right-click "Extract" option. The terminal method is faster once you are comfortable with it, but not required.
What is the difference between tar, tar.gz, and tar.bz2?
All three bundle files together. The ".gz" uses one type of compression; ".bz2" uses a different, usually tighter compression. The untarring command is almost the same: for tar.bz2, use tar -xjf filename.tar.bz2 instead. A plain ".tar" file is not compressed at all, just bundled.
Do I need to keep the tar.gz file after I untar it?
No. Once you have unpacked it and confirmed the files are there and correct, you can delete the tar.gz file. It is just a container. Some people keep it as a backup in case they need to untar again later, but it takes up space.
Why does my antivirus software warn me about a tar.gz file?
Antivirus software sometimes flags compressed files because malware is sometimes distributed this way. If you downloaded the file from a trusted source, it is almost certainly safe. If you are unsure, scan the unpacked files with your antivirus after untarring — that is safer than scanning the compressed version.