How to fix the “gzip: stdin: not in gzip format” error

Data conservation and transfer are extremely important aspects of computing. For this purpose, files are often archived or compressed based on the user’s needs. While dealing with such files, an error may pop up on your system with the statement “gzip: stdin: not in gzip format”.

This article will help to provide a detailed guide on the major reasoning behind this error and assist in fixing this issue.

How to Resolve the “gzip: stdin: not in gzip format” Problem?

To fully understand this error, it is important to gain some background knowledge of this reason. The “GNU” zip is a tool to compress any file or folder. Anything compressed using this tool gets the extension of “.gz” and the file is called a “gzip” file. Check out the sample below:

Reason: File is Not a “.gz” File

As demonstrated above, a file compressed using the gzip tool is renamed with a “.gz” extension. The error is prompted when the file with “.gz” in its name is not actually a gzip compressed file. This means that the file possibly got renamed to “.gz” manually. Check out the example shown below:

Notice, how the file in this snippet does not have the same icon as the “sample1” (shown above) compressed file that was shown above. That is because it is not a real gzip compressed file, and it has only been renamed to “.gz”.

This can also be confirmed using the command shown below:

$ file example.tar.gz

This command will display the type of file that is mentioned in the command. In this case, it clearly shows that the “example” file is not a compressed file. The “z” flag used in the command above is used for a gzip file. Since the “example” file, in this case, is not compressed and hence not a gzip file, the z option prompts the error.

Solution: Remove the “z” Option

Now that we have the complete background and information behind this error. Let’s check out how this issue can be resolved. The fix is extremely simple. Since the file is not compressed, the error can be fixed by simply removing the “z” option in the command, which only refers to gzip files. Following this, the correct command would be as follows:

$ tar -xvf example.tar.gz

The snippet above shows that removing the “z” option from the command enables the command to run successfully.


The “gzip: stdin: not in gzip format” problem is invoked when a file is incorrectly named to be “.gz” but it is not compressed. This causes problems with the “z” option in the command since this option is used only for real gzip compressed files. This error can easily be fixed by removing the “z” option from the “tar” command. This article provides detailed information on what causes this error and how to resolve it.