Convert XZ to TAR.GZ Online (LZMA2 Swapped for DEFLATE Gzip Compression)
The exact comparison every Linux downloads page implies but rarely explains: LZMA2 dictionary compression against DEFLATE, with real percentage differences and dates.
- Add a file Choose or drop it here
- Pick the format Change it whenever needed
- Download the result After conversion completes
The Comparison Every Software Downloads Page Quietly Assumes You Understand
Almost every open-source project's release page lists source code as both "project.tar.gz" and "project.tar.xz," offering the exact same files packaged the exact same way, differing only in which compression algorithm was applied. TAR.GZ uses gzip, built around the DEFLATE algorithm and standardized in RFC 1952 in the 1990s. TAR.XZ uses LZMA2 inside the .xz container, whose first stable specification arrived in December 2008 from the Tukaani project — roughly a decade and a half newer than gzip.
Converting XZ to TAR.GZ means decompressing the LZMA2 stream to recover the plain tarball underneath, then recompressing that same tarball with gzip's DEFLATE algorithm instead. The files, folder structure, and Unix permissions inside travel through both steps completely unchanged; only the compressed bytes on disk differ, produced by two genuinely different compression algorithms working on identical input.
Gzip's age is exactly why it shows up in far more places than XZ does. DEFLATE isn't just gzip's algorithm — it's also the compression method most ZIP files use by default and the compression PNG images rely on internally, which means functional DEFLATE decoders have been built into an enormous range of software, operating systems, and embedded devices for decades. XZ, being newer, doesn't have anywhere near that same universal baseline presence yet, even though every current major OS and most modern package managers now handle it without issue.
DEFLATE's LZ77-Plus-Huffman Design Against LZMA2's Larger Dictionary
DEFLATE, the algorithm inside gzip, combines LZ77-style back-reference matching with Huffman coding, using a sliding window capped at 32 KB — meaning it can only reference repeated data that appeared within the previous 32 KB of the stream. LZMA2, by contrast, supports a vastly larger dictionary window, commonly configured in the tens or hundreds of megabytes at higher compression presets, letting it spot repetition across a much wider span of a large file than DEFLATE's fixed 32 KB window ever could.
This window-size difference is the specific, concrete reason XZ tends to beat gzip by a wide margin on large, repetitive files like source code tarballs or disk images, while the gap narrows considerably on small files where a 32 KB window is already large enough to see the whole thing. LZMA2 also finishes its compression with range coding rather than DEFLATE's Huffman coding, a generally more effective but computationally heavier entropy-coding method, which is part of why XZ compression runs slower than gzip even before accounting for the dictionary-size difference between the two.
Decompression speed tells a different story than compression speed does. Because LZMA2 spends more effort during compression finding the best possible matches, decompressing an XZ file is often reasonably fast despite that upfront cost, and gzip's decompression is fast for the same reason it's fast to compress — DEFLATE's smaller window and simpler Huffman step are lightweight in both directions. This asymmetry, where XZ is slow to create but not dramatically slower to open compared to gzip, is exactly why "compress once, decompress often" pipelines like kernel releases lean toward XZ despite its heavier compression cost.
What Trading DEFLATE for LZMA2 Actually Costs and Saves
- Lose — the size advantage XZ was providing: .tar.xz archives are commonly reported as 20-30% smaller than the equivalent .tar.gz built from the same source tree, a gap that reverses once you recompress with gzip instead.
- Gain — noticeably faster compression: gzip's smaller 32 KB window and simpler Huffman coding step make it compress considerably faster than XZ, especially at XZ's higher presets.
- Gain — support in tools with no LZMA2 decoder at all: some very old or minimal environments include a gzip decoder as a baseline assumption but lack XZ support entirely.
- Unchanged — every file, folder, and Unix permission inside: only the compression wrapper is replaced; the TAR structure underneath is identical either way.
- Lose — the option of XZ's optional random-access blocks: XZ's stream/block/index structure allows certain tools to seek within a compressed file more efficiently than gzip's single continuous DEFLATE stream permits.
Why Kernel.org Kept Both Formats Available for Years
The clearest real-world data point for this comparison comes from the Linux kernel's own release infrastructure. Kernel.org began offering .tar.xz tarballs alongside the long-standing .tar.gz and .tar.bz2 options years before eventually narrowing its main pub download locations to XZ-only tarballs on September 1, 2018. During that multi-year overlap, both formats remained genuinely, actively supported rather than one being a legacy afterthought, specifically because scripts, mirrors, and build systems around the world depended on the .tar.gz option and needed time to migrate.
The motivation for eventually dropping gzip from the main release locations was concrete: with .tar.xz files running meaningfully smaller than the .tar.gz equivalents of the same kernel source tree, and the kernel project compressing each release exactly once while being downloaded by an enormous number of mirrors and individual developers, that size difference adds up to a real, measurable amount of saved bandwidth at global scale — a savings gzip's DEFLATE algorithm, with its smaller matching window, simply can't match on the same source data no matter how it's tuned.
Package ecosystems outside the kernel followed a similar pattern rather than adopting XZ overnight. Debian and its derivatives moved .deb packages toward XZ-based internal compression over time while keeping gzip-based tooling functional for backward compatibility, and many language-specific package registries still accept gzip-compressed source distributions as a safe universal default precisely because every consumer of those packages, however old their toolchain, can be assumed to have a working gzip decoder.
The Real Complaint Behind "My Build Server Ran Out of Memory"
A specific, documented problem reported by developers running XZ compression inside containerized build pipelines or memory-constrained CI runners is the build process failing or getting killed by the operating system's out-of-memory handler during the XZ compression step, something that essentially never happens with gzip on the same job. The cause is XZ's large dictionary at higher presets requiring substantially more RAM during compression than DEFLATE's fixed 32 KB window ever needs, and the documented fix in these threads is either lowering the XZ preset level, which shrinks the dictionary and memory footprint at some cost to final compression ratio, or falling back to gzip specifically for memory-limited build environments.
A second, unrelated complaint involves scripts written years ago that call gzip-specific commands or check for a ".tar.gz" extension explicitly, then fail or silently skip a file when handed a ".tar.xz" tarball instead, since the script never expected that extension. This isn't a flaw in either compression format — it's an extension-matching assumption baked into old automation that predates XZ's wider adoption, and the fix reported across build-tooling discussions is updating the script's extension check rather than anything to do with the archive's actual contents.
A third pattern reported in continuous-integration logs involves a job that worked fine on a developer's local machine but times out or gets killed on a shared build runner, traced back to the runner allocating fewer CPU cores or less memory than the developer's own machine has, which slows XZ's heavier compression step disproportionately compared to gzip's lighter one. Pinning the CI job to a lower XZ preset, or switching that specific automated step to gzip while keeping XZ for the final human-facing release artifact, is the fix most commonly reported for this exact mismatch.
DEFLATE's Small Window Set Beside LZMA2's Wide Dictionary
| Feature | TAR.XZ | TAR.GZ |
|---|---|---|
| Core algorithm | LZMA2 | DEFLATE (LZ77 + Huffman) |
| Match window size | Up to hundreds of MB at high presets | Fixed at 32 KB |
| Format standardized | December 2008 (.xz spec) | RFC 1952, early-to-mid 1990s |
| Typical size vs. same source tree | 20-30% smaller than .tar.gz | Larger on same data |
| Relative compression speed | Slower, more memory-intensive | Faster, lower memory use |
| Kernel.org main-location cutover | N/A | Dropped September 1, 2018 |
Questions About Downgrading a Release Tarball to Gzip
How much bigger will my file be after switching from XZ to gzip?
Commonly 20-30% larger, based on typical comparisons of the same source tree compressed both ways, though the exact difference depends heavily on how repetitive the underlying data is.
Why do some downloads still only offer .tar.gz instead of .tar.xz?
Gzip decodes with less memory and slightly broader legacy tool support than XZ, and some projects simply haven't updated their build pipeline; it's rarely a deliberate technical preference for gzip's compression ratio.
Did the Linux kernel drop .tar.gz entirely?
From its main pub download locations, yes, as of September 1, 2018, when kernel.org moved to XZ-only tarball releases after offering both formats for years during the transition.
Does this conversion touch any of the actual files in the archive?
No. TAR's file list, folder structure, and Unix permission bits are identical before and after; only the compression algorithm wrapping that structure changes.