Extract tar.gz File Windows: 4 Easy Ways
To extract a tar.gz file on Windows, you can use built-in tools like tar (available in Windows 10 and 11) or a third-party program like 7-Zip. This article explains four reliable methods, including command-line and graphical options, so you can choose the one that fits your comfort level.
What Is a tar.gz File?
A tar.gz file is a compressed archive format common on Linux and macOS. The .tar part means it is a collection of files bundled together (tape archive), and the .gz part means that bundle is compressed using gzip. This two-step process is why you often see files with double extensions like backup.tar.gz or package.tgz (the latter is just a shortened alias).
Windows does not natively display tar.gz contents in File Explorer, and double-clicking it usually opens a program like WinRAR or prompts you to choose an app. Unlike a .zip file, which Windows can open directly, tar.gz requires a tool that understands both the tar container and the gzip compression.
Method 1: Using the Built-in tar Command (Windows 10 & 11)
Starting with Windows 10 build 17063, Microsoft includes a full version of the BSD tar command in the operating system. This is the simplest method because it requires no extra software. Here’s how to use it:
- Open the Start menu, type
cmd, right-click “Command Prompt� and select “Run as administrator� (or just “Open� if you are the only user). - Navigate to the folder containing your tar.gz file. For example, if it’s in
C:\Users\YourName\Downloads, typecd C:\Users\YourName\Downloadsand press Enter. - Type the following command and press Enter:
tar -xzf filename.tar.gz
The -x flag means extract, -z tells tar to decompress with gzip, and -f specifies the filename. The files will be extracted into the current folder. If you want to extract to a specific directory, add -C followed by the path, for example: tar -xzf filename.tar.gz -C C:\Users\YourName\Desktop.
You can also use PowerShell, which understands the same command. Just open PowerShell, navigate to the folder, and run the same tar command.
Method 2: Using 7-Zip (Free and Open Source)
7-Zip is a free, open-source file archiver that handles tar.gz without any command-line knowledge. It is widely trusted and does not contain ads or trial pop-ups. To extract with 7-Zip:
- Download and install 7-Zip from the official website (7-zip.org).
- Right-click on the tar.gz file.
- In the context menu, choose 7-Zip > Extract Here or Extract to \”filename\”.
“Extract Here� dumps the files directly into the current folder. “Extract to filename� creates a new folder named after the archive, which keeps things tidy. Note that 7-Zip first decompresses the gzip layer, then extracts the tar archive, so you may see an intermediate .tar file if you choose “Extract to�. That is normal.
Method 3: Using WinRAR or Other GUI Archivers
WinRAR is another popular choice, though it is shareware (you can use it indefinitely but a license is requested after 40 days). It also supports tar.gz. The steps are similar: right-click the file, choose “Extract Here� or “Extract to folder�. WinRAR handles both layers automatically.
Other free options include PeaZip and Bandizip, which work in the same way. The key difference between these tools and the built-in tar command is the graphical interface—if you prefer clicking over typing, any of these will work.
Method 4: Using Windows Subsystem for Linux (WSL)
If you are a developer or power user who already has WSL installed, you can extract tar.gz files using the Linux command line. Open a WSL terminal (Ubuntu, Debian, etc.) and use the same tar -xzf command. This method is useful if you need to preserve Unix file permissions or symbolic links, which Windows-native tools may not handle perfectly.
To access your Windows files, they are mounted under /mnt/c/. For example, to extract a file in your Downloads folder, you would navigate to /mnt/c/Users/YourName/Downloads and then run the tar command.
Common Problems and How to Fix Them
- “tar is not recognized as an internal or external command� – This happens on older Windows versions (before Windows 10 build 17063). In that case, install 7-Zip or use WSL.
- Permission denied error – If you are extracting to a system folder like
C:\Program Files, you need to run Command Prompt as administrator. For your own user folders, this is rarely an issue. - File is corrupted – If tar reports “gzip: invalid compressed data�, the download may be incomplete. Re-download the file and try again.
- Long paths – Some archives contain paths longer than 260 characters, which Windows traditionally blocks. In Windows 10/11, you can enable long paths via the Group Policy editor or registry, but it is easier to extract to a short path like
C:\temp. - Files with unusual names – Linux archives may contain characters that Windows does not allow in filenames (like
:or?). In that case, 7-Zip will often rename them automatically, while the built-in tar may fail. If you encounter this, try 7-Zip.
How to Create a tar.gz File on Windows
Creating a tar.gz is just as easy. Using the built-in tar command, navigate to the folder containing the files you want to compress and run:
tar -czf archive.tar.gz folder_name
The -c flag creates a new archive, -z compresses with gzip, and -f names the output file. With 7-Zip, you can right-click a folder and choose 7-Zip > Add to archive, then select “tar.gz� from the archive format dropdown.
Security and Safety Considerations
Before extracting any archive, be aware that tar.gz files can contain malicious content just like any other downloaded file. Always scan the archive with your antivirus software before extracting. Also, be cautious about extracting archives that contain absolute paths (starting with /) or paths with .. (parent directory) because they could overwrite files outside the target folder. Both 7-Zip and the Windows built-in tar generally block these dangerous paths, but it is still good practice to extract to a dedicated folder and inspect the contents.
There is no cost to any of the methods described here—the built-in tar is free, 7-Zip is free, and WSL is a free feature of Windows. WinRAR is not free for long-term use, but you can use it for a trial period.
Frequently Asked Questions
Can Windows open tar.gz files without any software?
Yes, if you have Windows 10 or 11 with the latest updates, you can use the built-in tar command in Command Prompt or PowerShell. There is no graphical built-in option, but the command works reliably.
Why does my tar.gz file extract to a .tar file first?
That happens when you use a tool that only decompresses the gzip layer and does not automatically handle the tar layer. For example, if you use a gunzip utility, you get a .tar file. Programs like 7-Zip and WinRAR handle both steps, but if you see an intermediate .tar, just extract that with the same tool.
Is there a difference between .tar.gz and .tgz?
No, they are identical. The .tgz extension is just a shortened version of .tar.gz, often used to avoid long filenames in older systems. Both are extracted the same way.
How do I extract a tar.gz file on Windows 7?
Windows 7 does not have the built-in tar command, so you need a third-party tool like 7-Zip or WinRAR. The steps are the same as described above—right-click and extract.
Can I extract only a specific file from a tar.gz without extracting everything?
Yes. With the built-in tar command, use tar -xzf archive.tar.gz path/to/file to extract just that file. With 7-Zip, open the archive, navigate to the file, and drag it out. This is useful if you only need one file from a large archive.
What should I do if the extraction fails with a “file name too long� error?
This is usually a Windows path length limitation. Try extracting to a short root folder like C:\temp. Alternatively, enable long paths in Windows (via Group Policy or the registry), but that requires a restart and is not recommended for casual users.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.