What is the TGZ file format?
.tgz is an archive format produced by the GNUzip (Gzip) tool. This format is in no way related to the Windows ZIP format. .tgz files store TAR archives that have been compressed with the DEFLATE algorithm via gzip. The .tgz extension is equivalent to .tar.gz - the two are exactly the same format; .tgz is simply the 8.3-compatible short form of .tar.gz, introduced to fit the DOS/Windows filename length limit.
GNUzip originated on Unix systems and was designed to replace the older compress archiving format. Gzip was created as a free replacement for compress and other patent-encumbered compression algorithms in use at that time. The .tar.gz spelling is more popular on Unix-like platforms, while the .tgz form is commonly seen on Windows. Software packages for Linux distributions - including source releases and system tools - are frequently distributed as .tgz archives.
Because gzip compresses the entire TAR stream as one solid block rather than compressing files individually, it is not possible to list or extract a single file without decompressing the whole stream. .tgz archives carry a gzip magic signature (1F 8B 08) at offset 0; the inner TAR structure is revealed only after decompression. Gzip archives containing TAR data are commonly referred to as "tarballs" in IT and open-source circles.
Security & safety
RISK: LOWThe tar+gzip formats are open and safe, and a .tgz is just compressed data that can't run by itself. Standard archive caution: a .tgz from an untrusted source can contain scripts or executables revealed only after extraction, so scan contents before running anything. Two technical notes: a tiny .tgz can expand enormously ('decompression bomb'), and tar members can carry '../' paths (path-traversal / 'tar slip') - modern extractors guard against this, but extract untrusted tarballs into an empty folder.
Format details
in a nutshellPrograms that open TGZ files
Technical details
deep spec| Container structure | TAR archive wrapped in a single gzip stream; files are not compressed individually but as one solid stream |
| Compression algorithm | DEFLATE via gzip (RFC 1952); the entire TAR payload is compressed as one contiguous block |
| Encoding | Binary |
| Byte order | Little-endian (gzip header fields stored in little-endian order) |
| Magic bytes | `1F 8B 08` at file offset 0 (gzip ID1/ID2 bytes + DEFLATE method flag); inner TAR reveals `ustar` at offset 257 only after decompression |
| MIME type | `application/gzip`; alternatives include `application/x-gzip`, `application/x-compressed-tar`, `application/x-gtar` |
| Relation to .tar.gz | Identical binary format; `.tgz` is the 8.3-filename-safe alias of `.tar.gz`, introduced for DOS/Windows compatibility |
| Typical use | Linux/Unix software source releases, system backups, dataset distribution, package archives |
| Encryption | None built-in; gzip and tar provide no encryption - encrypt separately (e.g. with GPG) before or after archiving |
| Integrity checking | gzip footer contains CRC-32 and ISIZE (uncompressed size mod 2^32); each 512-byte tar header also carries its own checksum field |
| TAR header size | 512 bytes per entry, storing filename, permissions, ownership, and timestamps; long filenames supported via GNU or pax extensions |
| TAR format variants | v7, USTAR (POSIX.1-1988), GNU tar, POSIX pax (POSIX.1-2001) - all can be wrapped in a `.tgz` |
| File count limit | Effectively unlimited; files are appended sequentially in the tar stream with no hard cap |
| Random access | Not supported; the gzip stream must be decompressed from the beginning before any individual entry can be read or extracted |
| Typical file size | Tens of KB to several GB (source tarballs, backups, dataset archives) |
| Platform support | Native on Linux, Unix, and macOS; Windows 10 and 11 include a built-in `tar` command with `.tgz` support |
| Released | tar (1979, Unix V7); gzip (1992); .tgz is the DOS/8.3-safe form of .tar.gz |
| Latest version | POSIX.1-2001 (pax) tar + gzip RFC 1952 |
| Open standard | Yes · royalty-free |
| Specification | www.rfc-editor.org |
TGZ conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about TGZ files.
Frequently asked questions
What is a TGZ file?
What's the difference between .tgz and .tar.gz?
How do I open a TGZ file on Windows?
tar -xzf file.tgz in a terminal.How do I open a TGZ on Mac?
How do I extract a TGZ in one step on Linux?
tar -xzf file.tgz. To create one: tar -czf archive.tgz folder/.