42

What is the correct MIME type for a tar.gz file?

I've searched around and found several values being used, including:

application/x-gzip
application/x-gtar
application/x-tgz

But I could find no indication as to which of these (if any) was the correct or canonical value.

67

As of August 2012, the MIME type recommended in RFC 6713 is application/gzip.

According to the IANA registry, tar is not an official media type, so a GZipped tar file is officially only a compressed file.

Hypothetically, if a tarball were an official media type and following conventions, its MIME type would be application/tar (file extension .tar) and its compressed version would be application/tar+gzip (file extensions .tar.gz and .tgz).

  • "application/zip" worked for me. I always thought tar.gz was just a zipped tarball. – PJ Brunet Feb 19 '17 at 22:21
  • 3
    @PJBrunet That would be an incorrect media type because application/zip is a different format than application/gzip and tar.gz is a gzipped tarball; Zip uses multiple compression methods, not all of which are freely licensed. Perhaps you got lucky and your decompression library recognizes both formats from their data stream. – Suncat2000 Mar 7 '17 at 16:58
  • 1
    If tar is not an official media type, would that not make application/x-tar+gzip the most correct? I feel that would be more clear even if it's less... official. – Will S Jul 9 '18 at 12:56
4

Although most are deprecated, they are all technically correct, just different MIME types.

The correct MIME type is application/x-gzip according to cPanel standards.

  • 1
    When I rewrote the file with application/x-gzip, It got corrupted. But when I used application/gzip , it worked. – Amit Kumar Gupta Dec 4 '16 at 16:15
  • 15
    cPanel isn't a standard of anything except bad coding practices. – Lizardx Aug 17 '17 at 19:12
  • hahaha. ooouch ! – Kennet Celeste Nov 21 '19 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.