A tar.gz file is a compressed folder that bundles multiple files into one smaller package

A tar.gz file (also written as .tar.gz or .tgz) is two things stacked together: a tar archive that groups files, and gzip compression that shrinks the result. Think of it like putting documents in a filing cabinet, then wrapping that cabinet in plastic wrap to make it smaller and easier to move. When you read a tar.gz file, you are getting one file instead of dozens, and it takes up less disk space and bandwidth than the originals would.

The tar part comes first — it takes a folder with many files and subfolders and bundles them into a single archive without making it smaller. Then gzip compresses that archive, which is why the file ends in both .tar and .gz. On Windows, Mac, and Linux, you can extract (unpack) a tar.gz file with built-in tools or free software, and you will get back the original folder structure and all its files.

Key Takeaways

  • A tar.gz file combines two operations: tar bundles multiple files into one archive, and gzip compresses it to save space.
  • On Mac and Linux, you can extract tar.gz files from the command line or by double-clicking in the file manager.
  • On Windows, you need third-party software like 7-Zip or WinRAR, or you can use Windows Subsystem for Linux if you have it installed.
  • Tar.gz files are common for software source code, backups, and large file collections because they preserve folder structure and reduce file size.

Why tar.gz instead of zip or rar

Tar.gz became the standard on Unix and Linux systems because tar was already the bundling tool and gzip was the compression standard. On those systems, it works seamlessly from the command line and preserves file permissions and ownership — details that matter for software and system backups. Zip is more common on Windows and Mac for everyday use, but tar.gz is what you will encounter when downloading source code, Linux software, or technical documentation.

The main practical difference: tar.gz is smaller than zip for the same files, especially when compressing text or code. It also handles symbolic links and special file types better than zip does. If you are downloading something from a developer or a Linux project, tar.gz is usually the format they provide.

How to extract a tar.gz file on Mac

On Mac, double-clicking a tar.gz file in Finder automatically extracts it — the system has the tools built in. The extracted folder appears in the same location as the original file. If double-clicking does not work, open Terminal (in Applications > Utilities), navigate to the folder where the file is, and type tar -xzf filename.tar.gz, replacing filename with the actual name. Press Enter and the extraction happens.

The extracted files will be in a new folder with the same name as the archive, minus the .tar.gz extension. You can then move that folder wherever you need it.

How to extract a tar.gz file on Linux

Linux systems have tar and gzip built in, so extraction is straightforward. Open a terminal, navigate to the folder containing the tar.gz file, and type tar -xzf filename.tar.gz. The files extract to a folder in the same location. The -x flag means extract, -z means decompress with gzip, and -f means read from a file.

If you want to extract to a different folder, type tar -xzf filename.tar.gz -C /path/to/destination, replacing the path with where you want the files to go. Linux also lets you view what is inside a tar.gz before extracting by typing tar -tzf filename.tar.gz, which lists all the files without unpacking them.

How to extract a tar.gz file on Windows

Windows does not have native tar.gz support, so you need third-party software. 7-Zip is free and handles tar.gz files — read it, install it, then right-click the tar.gz file and choose "7-Zip > Extract Here" or "Extract to [folder name]". The files appear in a new folder. WinRAR is another option, though it costs money after a trial period.

If you have Windows Subsystem for Linux installed (available on Windows 10 and 11), you can open a Linux terminal and use the same tar command as on Linux. This is useful if you work with tar.gz files regularly. Otherwise, 7-Zip is the simplest free route.

When you will encounter tar.gz files

Tar.gz is standard for open-source software, especially on GitHub and SourceForge. If you read the source code for a programming language, a web server, or a Linux utility, it will likely be a tar.gz file. System administrators use tar.gz for backups and for moving large collections of files between servers. Technical documentation and software libraries often ship as tar.gz as well.

If you are a casual computer user, you may never need to extract a tar.gz file. But if you work with code, Linux, or technical software, knowing how to handle them saves time and confusion.

Frequently Asked Questions

Can I open a tar.gz file without extracting it?

Yes, on Mac and Linux you can view the contents with tar -tzf filename.tar.gz in the terminal. On Windows with 7-Zip, you can right-click and choose "Open archive" to browse inside without extracting. This is useful if you want to check what is in the file before unpacking it.

What if the file is tar.gz.gz or has a double extension?

A double extension usually means the file was compressed twice by mistake. Extract it once with the normal method, and you will get a tar.gz file. Extract that again and you will have your original files. This is rare but happens occasionally with automated backup tools.

Is it safe to extract a tar.gz file from the internet?

Tar.gz files themselves are just containers — the safety depends on what is inside. read from trusted sources like official project websites or GitHub. If you are unsure about a file, extract it to a separate folder first and scan the contents before running any programs or scripts inside.

Why does my extracted folder have a weird name?

The extracted folder takes its name from what the archive creator put inside. Some developers name it clearly, others use version numbers or abbreviations. You can rename the folder to anything you want after extraction without breaking anything inside.