Convert TGZ to TAR.GZ Online (Same Format, Real Reasons to Rebuild It Anyway)
Settling the TGZ-versus-TAR.GZ naming question first, then the actual technical reasons someone recompresses a file that is already gzip-compressed.
- Add a file Choose or drop it here
- Pick the format Change it whenever needed
- Download the result After conversion completes
Confirming There's No Actual Format Difference Here
A .tgz file and a .tar.gz file are the exact same format with no technical distinction whatsoever — both are a tar archive, the Unix bundling structure from Seventh Edition Unix in 1979, compressed with gzip, released by Jean-loup Gailly and Mark Adler in October 1992. The shortened .tgz spelling exists specifically because the full ".tar.gz" didn't fit old 8.3 DOS filename rules or the 14-character limit some early Unix systems enforced, not because of any difference in the bytes themselves. GNU tar's own -a / --auto-compress option treats both suffixes identically, mapping either one to gzip without distinguishing between them in any way.
So a straightforward file that's already valid, already gzip-compressed, correctly named .tgz getting "converted" to .tar.gz with no other change is just a rename — nothing about the archive's actual content, compression, or structure needs to be touched at all. The genuinely useful version of this conversion involves an actual technical change happening alongside the extension, and two real ones come up often enough to be worth explaining directly.
It's worth being explicit about this because a fair number of pages discussing archive formats treat the two spellings as somehow different tiers of the same format, or hint at a subtle distinction without ever stating clearly that none exists. There isn't one. Every gzip-aware tool has to recognize both spellings, since real files in the wild use each one interchangeably, and no tool that only understood one of the two would be considered functional.
Recompressing at a Different Gzip Level, and Fixing a Multi-Member Stream
Gzip supports compression levels from -1 (fastest, weakest compression) through -9 (slowest, strongest compression), with -6 as the long-standing default. The gap between levels is real but often smaller than people expect: going from level 6 to level 9 typically gains only around 1 percent more compression while adding several times more CPU time, whereas moving from level 1 up to level 6 captures most of the available size reduction for a much smaller time cost. Recompressing a TGZ at a different level is a genuine, useful operation — for example moving from a fast, low level used during active development to a maximum level used for a final distributed release.
The second real technical issue is more subtle and specifically documented across several tools and programming languages: gzip supports "multi-member" files, where multiple independent gzip streams are simply concatenated one after another with nothing marking the boundary except the next stream's own header. This is a valid gzip file by the format's own rules, but a documented, recurring bug pattern shows several tools and libraries — including some default gzip readers in .NET, Ruby, and other environments — only decompress the first member and silently stop there, discarding every gzip stream concatenated after it. Recompressing a multi-member TGZ into a single, clean gzip stream resolves this specific class of failure directly.
Multi-member gzip files aren't a bug or an accident when they're created in the first place — some real formats intentionally rely on the behavior, such as the WARC web-archive format and certain OpenBSD package files, where the first gzip member deliberately holds metadata and later members hold the actual payload, with a well-written reader expected to step through each member in sequence. The trouble only appears when a file gets handed to a reader that assumes, incorrectly, that every gzip file has exactly one member.
What Rebuilding a TGZ Can Actually Change and What It Can't
- Gain or lose size, depending on direction: recompressing at a higher gzip level shrinks the file somewhat; recompressing at a lower level trades size for faster future compression passes.
- Gain — a single-stream file instead of a problematic multi-member one: rebuilding collapses a concatenated multi-member gzip file into one clean stream, avoiding the documented "only reads the first member" bug in several tools and libraries.
- Lose — nothing about the extension's meaning: since .tgz and .tar.gz describe an identical format, renaming alone changes nothing technical about the file.
- Unchanged — every file's name, permissions, and ownership inside the tar layer: recompression only touches the outer gzip stream, never the tar structure or its recorded metadata.
- Gain — a fresh CRC-32 checksum matching the exact rebuilt stream: every gzip stream ends with a CRC-32 of the uncompressed data, and rebuilding regenerates that checksum to match whatever specific bytes were just compressed.
- Unchanged — the file's actual identity as a valid TGZ: whether recompressed at a different level or consolidated from multiple members into one, the result is still a completely standard, readable gzip-compressed tar archive.
Which Tools Actually Expose These Specific Rebuild Options
GNU gzip's own command line accepts a numeric level flag directly, from -1 through -9, and re-running it against a decompressed tar stream produces a file at whatever level is specified, regardless of what level created the original. 7-Zip and WinRAR both expose a compression level setting in their archive creation dialogs when building a .tar.gz or .tgz output, letting the same choice be made through a graphical interface rather than a terminal command.
Detecting a multi-member gzip file specifically usually requires checking for more than one gzip magic-byte header (0x1F 0x8B) inside the same file, since a standard decompressor given a multi-member file won't necessarily report an error — it may simply stop after the first member without any warning, which is exactly the documented failure mode reported against several gzip-reading libraries. Rebuilding the file with a single decompression-then-recompression pass, rather than a byte-for-byte copy, guarantees the result has exactly one member.
GNU gzip itself, when run with its own -d flag, does correctly decompress every member in a multi-member file in sequence, concatenating the output, which is exactly why the safest fix is running the file through gzip's own decompression and recompression rather than assuming any arbitrary third-party library handles multi-member data the same careful way.
The Real-World Bug Reports Behind This Conversion
A documented issue reported against Ruby's Zlib::GzipReader, and separately against .NET's GZipStream, describes each library decompressing only the first gzip member in a concatenated multi-member file and silently discarding the rest, with no error raised to indicate data was left behind — a serious, specific bug class that has affected real production systems processing package files or logs built by concatenating gzip streams. The fix reported in each case is either patching the reading code to loop over all members, or, more simply from the file-producing side, ensuring the TGZ being distributed is rebuilt as a single clean gzip stream in the first place.
A second, unrelated but common request involves a development build compressed quickly at a low gzip level during active iteration needing to be recompressed at the maximum level before final release, purely to shrink the download size for end users without changing anything about the tar contents itself — a straightforward, low-risk operation precisely because gzip decompression and recompression are both fully lossless.
Gzip Compression Levels Compared Side by Side
| Setting | Level 1 (--fast) | Level 6 (default) | Level 9 (--best) |
|---|---|---|---|
| Relative speed | Fastest | Balanced | Slowest, roughly 10x level 1 |
| Compression achieved | Lowest | ~95% of maximum possible | Highest, only slightly more than level 6 |
| Typical use case | Active development iteration | General-purpose default | Final release, one-time build |
Questions About Rebuilding an Already-Gzipped Tar Archive
Is there any real difference between a .tgz file and a .tar.gz file?
No. They're the exact same format; .tgz is simply a historical shortened spelling created for old 8.3 DOS and short Unix filename limits, and the underlying bytes are identical either way.
Why would I recompress a file that's already gzip-compressed?
Two real reasons: changing the compression level to trade size against speed, or fixing a multi-member gzip stream that some tools and libraries only partially read, silently dropping data after the first member.
What is a multi-member gzip file and why does it cause problems?
It's multiple gzip streams concatenated in one file, which is valid by gzip's own format rules, but a documented bug in several tools and libraries only decompresses the first stream and silently discards the rest, without raising any error.
Does changing the gzip compression level affect the files inside the archive?
No. The tar structure and every file's name, content, and permissions stay identical; only the compressed size of the outer gzip stream changes based on the level chosen.
How do I know if my TGZ file has more than one gzip member?
Scanning the file for more than one occurrence of the gzip magic bytes, 0x1F 0x8B, is the direct way to check. If a reading tool only ever seems to process part of a file's expected content, an undetected multi-member stream is a documented, common cause.