GZ to TAR.GZ

Nothing you choose here leaves your browser, and nothing is downloaded to make it work — not a library, not a compression module, nothing. Your browser already knows how to deflate and gzip; this page writes the tar.gz around it.

…or drop one anywhere on this page.

This repacks a lone file as a proper one-file archive.

It sounds circular and it is not: the input has no list of contents and the output does. A .tar.gz is a tar inside a gzip, so the file is decompressed, given a tar header with its name and size, and compressed again. Tools that expect a tar.gz and choke on a bare .gz will then read it — which is the usual reason for wanting this.

How this works, and why nothing is fetched

Your browser already knows how to un-gzip, because it needs to for web pages, and this page reaches that through DecompressionStream. What it then writes — a ZIP directory or a tar header — is a byte layout rather than an algorithm, so it is written outright. Nothing is fetched and nothing is installed.

A .gz is not an archive, and does not always know the name

gzip compresses one stream. It keeps no list of contents, no folders, no sizes and no permissions — there is nowhere in the format to put them. A file that unpacks to several files is a .tar.gz: a tar, which is an archive, that was then gzipped. If that is what you have, the tar.gz pages are the ones that will list your files.

The name is the part that catches people. The gzip header has one optional field for the original filename. Most tools fill it in; some do not, and anything gzipped as it is being written cannot. When it is missing there is nothing left to go on but the name of the .gz itself with the extension removed — which is why data.gz comes out as data, with the .txt somebody was expecting nowhere to be found. Both cases are handled here: the header is read when it is there, and the fallback is said on screen rather than presented as fact.

What it will not do

It will not open a RAR, and nothing ever writes one: RARLAB's licence forbids using their code to re-create the RAR algorithm, which is proprietary. That is a legal restriction and not a difficulty. It will not open a 7z, bzip2 or xz either — those need compressors your browser does not have, so supporting them would mean shipping one, which is the thing this page avoids. It says which of these it is looking at rather than just refusing.

It does not open password-protected archives, and it says so per file rather than failing silently. It reads plain ZIPs rather than ZIP64, so an archive over 4 GB or with more than 65,535 files is refused with that reason given.

Where to go next