What is TGZ? The tar.gz Compressed Archive Format Explained

TGZ (tar.gz) is a gzip-compressed tar archive widely used on Unix and Linux for distributing source code, backups, and software packages.

Free online file converter tool. Works in Chrome Firefox Safari Edge Opera and other modern browsers on Windows macOS Linux Android and iOS. No software installation or sign-up required. All conversions run directly in your browser, so your files never leave your device. Free to use with no account needed.

Archive

What is TGZ? The tar.gz Compressed Archive Format Explained

A gzip-compressed tar archive that bundles files and then shrinks them in one stream.

Last updated:

Year Created1992
CompressionArchive + compression
Primary UseSource and software distribution

What is TGZ?

TGZ, also written as .tar.gz, is a compound format in which files are first combined into a single tar archive and that archive is then compressed with gzip. The result is one file that preserves Unix file structure and metadata while reducing size.

The two stages are separate: tar handles bundling and metadata such as permissions and timestamps, while gzip applies DEFLATE compression to the whole tarball. The .tgz extension is simply a shorthand for .tar.gz, and the file is decompressed by gunzip and then unpacked by tar.

How TGZ Works

Creating a .tar.gz is a two-stage pipeline. First, tar concatenates files into a single stream, prefixing each with a 512-byte header recording its name, permissions, ownership, and timestamps.[4] Then gzip compresses that entire tarball as one continuous stream using the DEFLATE algorithm, wrapped in the gzip header and trailer.[1]

Why Bundle Before Compressing

Because gzip operates on a single byte stream rather than a set of files, the tar step is what allows many files to be stored together; compressing the combined archive also lets DEFLATE exploit redundancy across file boundaries.[3] The GNU tar tool can invoke gzip automatically through its -z option.[2]

Technical Details and Limitations

Solid, whole-archive compression means there is no central index, so extracting one file generally requires decompressing the stream up to that point.[1] A corrupted region can also render the remainder of the archive unrecoverable, since gzip lacks per-file recovery records.[3]

MKV Technical Specifications

Developertar by Unix/GNU; gzip by Jean-loup Gailly and Mark Adler[1]
File Extension.tgz, .tar.gz[1]
MIME Typeapplication/gzip[1]
Releasedgzip released 1992[1]
TypeGzip-compressed tar archive[1]

TGZ vs Other Archive Formats

FeatureTGZZIPTAR
StructureTAR + gzip[2]Single containerBundle only
Compressiongzip / DEFLATE[1]DEFLATENone
Per-file accessNo[3]YesYes
Preserves Unix metadataYesLimitedYes
Best forUnix source/release tarballsCross-platform sharingBundling only

TGZ compresses an entire TAR stream as a whole, so unlike ZIP it cannot extract a single file without decompressing the archive.

Advantages & Disadvantages

Advantages

Preserves Unix metadata | FileFormer

The tar layer keeps permissions, ownership, symlinks, and timestamps intact through compression.

Solid compression | FileFormer

Because gzip compresses the entire tarball as one stream, cross-file redundancy improves the overall ratio.

Ubiquitous tooling | FileFormer

tar and gzip are standard on virtually every Unix and Linux system, requiring no extra software.

Streamable | FileFormer

Archives can be created and extracted on the fly through pipes, ideal for backups and network transfer.

Disadvantages

No random access | FileFormer

Because the whole archive is a single compressed stream, individual files cannot be extracted without reading from the start.

No built-in encryption | FileFormer

Neither tar nor gzip provides encryption, so security must be added with separate tools.

Single-stream fragility | FileFormer

Corruption early in the gzip stream can make the remainder of the archive unrecoverable.

Common Use Cases

TGZ is a default choice for packaging and moving files in Unix-like environments.

Source code distribution | FileFormer

Open-source projects commonly release source tarballs as .tar.gz downloads.

Backups | FileFormer

System administrators archive directory trees into compressed tarballs for storage and transfer.

Software packaging | FileFormer

Many Unix software bundles and language package ecosystems ship artifacts as tgz files.

Convert TGZ Files Free

Use our free online archive converter to convert TGZ and other formats - no signup, no watermarks.

Try Archive Converter Free

Frequently Asked Questions

What is the difference between tar and tgz?

A .tar file is an uncompressed archive, while a .tgz (or .tar.gz) is that same tar archive compressed with gzip.

How do I extract a tgz file?

Use 'tar -xzf archive.tgz', where the z flag tells tar to run the data through gzip during extraction.

Is tgz the same as tar.gz?

Yes. The .tgz extension is just a shorter way of writing .tar.gz.

Why use tgz instead of zip?

tgz preserves Unix file metadata and compresses the whole archive as one stream, which often yields smaller results for many small files.

Can I extract a single file from a tgz?

You can name a specific file, but tar must still read through the gzip stream to reach it because the format has no random-access index.

References

  1. GZIP File Format - Library of Congress
  2. GNU tar Manual - GNU Project
  3. gzip - Wikipedia
  4. tar (computing) - Wikipedia