Universal Zip
Windows 10 & 11 Buy license · $24.95
Open and extract

How to Open and Extract a TAR.GZ File on Windows

How to open a tar.gz file in Windows using File Explorer, the built-in tar command or an archive program, plus what TGZ, TAR.BZ2 and TAR.XZ files are.

Updated 5 minute read The Universal Zip team

There are three ways to open a TAR.GZ file in Windows. On Windows 11 version 23H2 or later, double-click it or right-click and choose Extract All in File Explorer. On Windows 10 (version 1803 or later) and Windows 11, you can run the built-in command tar -xzf file.tar.gz in Command Prompt or PowerShell. On any version of Windows, an archive program extracts it from the right-click menu in one step, without the intermediate .tar file some tools leave behind.

Below you will find each method step by step, what the related TGZ, TAR.BZ2 and TAR.XZ files are, and the problems that come up when Linux archives meet Windows.

What a TAR.GZ file is

A TAR.GZ file is made in two layers:

  • TAR bundles many files and folders into one file, without compressing them.
  • GZ (gzip) then compresses that single bundle.

The combination is the standard way to package source code, Linux software, website backups and server logs. The same idea applies to other compressors:

ExtensionWhat it isWhere you see it
.tar.gz or .tgzTAR compressed with gzipSource code, hosting backups, most Linux downloads
.tar.bz2 or .tbz2TAR compressed with bzip2Older Linux packages
.tar.xz or .txzTAR compressed with xzLinux kernel and distribution sources
.tarUncompressed bundleBackups, intermediate files
.gz aloneA single compressed fileCompressed logs and database dumps

Method 1: File Explorer (Windows 11 23H2 and later)

  1. Check your version in Settings → System → About.
  2. Double-click the TAR.GZ file to browse it like a folder, or right-click it and choose Extract All.
  3. Choose a destination and click Extract.

This is the quickest option on an up-to-date Windows 11 PC, and it handles TGZ, TAR.BZ2 and TAR.XZ files the same way. Large source archives can take a while, because Explorer works through thousands of small files. On Windows 10 or earlier Windows 11 builds, File Explorer will not recognize the file.

Method 2: The built-in tar command (Windows 10 and 11)

Windows 10 version 1803 and later include tar.exe, the same tool Linux users rely on.

  1. Open the folder containing the file in File Explorer.
  2. Click the address bar, type cmd and press Enter. A Command Prompt opens in that folder.
  3. Run: tar -xzf archive.tar.gz
  4. To extract to a different folder that already exists, add -C: tar -xzf archive.tar.gz -C C:\extracted

What the letters mean: x extracts, z means gzip, and f means the next word is the file name. The Windows tar can usually detect the compression on its own, so tar -xf archive.tar.xz works for XZ and BZ2 files too. To list contents without extracting, use tar -tzf archive.tar.gz.

tar extracts silently and overwrites existing files with the same names without asking. Extract into an empty folder if you are not sure what is inside.

Method 3: An archive program (any Windows version)

Archive programs are the most convenient choice if you handle these files regularly, or if you are on Windows 7 or 8. With Universal Zip:

  1. Right-click the .tar.gz file.
  2. Choose Extract to folder or Extract Here.
  3. Open the resulting folder.

Universal Zip opens TAR, GZ, TGZ, BZ2 and XZ files and can also create them, which is useful when you need to send files back to a Linux server. You can also double-click a TAR.GZ to browse it and drag out a single config file or log without unpacking the whole archive.

Some older extractors handle the two layers separately: the first extraction turns file.tar.gz into file.tar, and you then extract that to get the actual files. If you see a lone .tar after extracting, just extract it once more.

Problems when extracting Linux archives on Windows

Invalid file names

Linux allows characters in file names that Windows does not, such as :, ?, *, ", <, > and |. Files with those names cannot be created on Windows, so extraction reports errors for them. Linux is also case sensitive, so an archive can contain both README and readme, which collide on Windows.

Symbolic links

Source code archives often contain symlinks. Windows restricts creating symlinks to administrators or to accounts with Developer Mode turned on, so they may fail or be skipped. For most purposes, such as reading the code or editing config files, this does not matter.

Path length

Deep source trees can exceed Windows' traditional 260-character path limit. Extract to a short folder such as C:\src. Our guide to fixing path too long errors has more options.

Checking the download first

Linux projects often publish a SHA256 checksum next to each download. If extraction fails with a "not in gzip format" or unexpected end error, check the file before blaming the tool. In PowerShell, run Get-FileHash archive.tar.gz and compare the result with the published value. If they differ, the download is incomplete or damaged and needs to be fetched again. A file of only a few kilobytes is often an error page that was saved by mistake.

Line endings and permissions

Text files from Linux use different line endings from Windows. Modern editors, including Notepad on Windows 10 and 11, display them correctly. Unix file permissions are not preserved on Windows, which matters only if you plan to re-pack the files and send them back to a server.

Opening a plain .gz file

A .gz without .tar is usually a single compressed file, such as access.log.gz or database.sql.gz. Extracting it gives you that one file. An archive program handles it with the same right-click command. Once extracted, open logs and SQL dumps in a text editor that copes with large files.

Going the other way

If you need to upload files to a Linux server or share them with a developer, creating a TAR.GZ on Windows is just as easy. Our guide to creating a TAR.GZ file on Windows covers the command and the archive program methods, plus how to avoid the file name pitfalls above. For a broader look at how these formats compare with ZIP and 7Z, see ZIP vs 7Z vs RAR.

Frequently asked questions

What is a tar.gz file?

It is a TAR archive that bundles many files into one, then compressed with gzip. It is common for Linux software, source code and server backups.

Is tgz the same as tar.gz?

Yes. TGZ is a short extension for the same thing, a gzip-compressed TAR archive, and it opens the same way.

Does Windows have a tar command?

Yes. Windows 10 (since 2018) and Windows 11 include tar.exe, so you can run tar -xzf file.tar.gz in Command Prompt or PowerShell.

Get three guides like this every month, plus software update notices.Subscribe →