List of ALL MimeTypes on the Planet, mapped to File Extensions?

Mime TypesFile Extension

Mime Types Problem Overview


Is there a resource that lists ALL the mimeTypes in existence?

I have found a few places with under 1000 mimeTypes, but then they still don't include common ones like .rar, .fla, .rb, .docx!

Does anyone have a COMPLETE list of mimetypes? Not down to the most obsure "company-only" ones, but at least all of the ones we might use.

Also, I'm looking for a list that maps file extensions to mimeTypes.

Mime Types Solutions


Solution 1 - Mime Types

http://www.iana.org/assignments/media-types/ lists the "official" mime-types, but it doesn't prevent anyone making their own an not registering it with IANA.

Solution 2 - Mime Types

Here's the most up-to-date mime.types maintained by the Apache HTTPD community: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/conf/mime.types?view=annotate

Solution 3 - Mime Types

IANA lists the official ones. A list which includes file extensions which I find useful is the one included as /etc/mime.types in Debian & Ubuntu.

The Apache web server project also maintains a list.

Solution 4 - Mime Types

I collected MIME types and file extensions from many sites and lists, and here's the result: https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.txt

I also created a JSON file: https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json

Please tell me if something is missing or incorrect

Solution 5 - Mime Types

iana is tracking the official ones but of course folks can always declare their own...

In other words, it is doubtful you'll ever get the full list on the Planet.

Also consider the case of NPAPI plugins which declare MIME-types just to be be easily accessible... and these MIME-types might be not interesting to you for a reason or another.

Solution 6 - Mime Types

If your are using Java you could use Apache Tika, which is a powerful library for dealing with file types. With it you can easily get the preferred extension related to a mime type with a couple of rows:

TikaConfig config = TikaConfig.getDefaultConfig();
MimeType mimeType = config.getMimeRepository().forName("image/png"); //Generally your textual mime type
String extension = mimeType.getExtension();
// this would return the extension with the dot. For "image/png" returns ".png"

In this way you don't have to mess with downloading and parsing a file with the associations, I find it very comfortable. This is the way I've done the trick.

Solution 7 - Mime Types

There is a good Mime Type Table you can find on https://drive.google.com/open?id=0By00BwrZ8886VUg3ak9faG5mTU0 Which is updated 27-02-2017. I am sure that meet your all needful mime type.

Solution 8 - Mime Types

There's a good table in the classic book "HTTP: The Definitive Guide" by Gourley and Totty (O'Reilly, with a squirrel on the cover) in Appendix D. It appears to be complete and up-to-date as of the time the book was written (in 2002). That was a long time ago, but you'll find all the old favorites there as well as obscure "company-only" ones.

ISBN 1-56592-509-2, http://oreilly.com/catalog/9781565925090/

Solution 9 - Mime Types

Here is a full list that is easy on the eyes:

http://www.webmaster-toolkit.com/mime-types.shtml

Solution 10 - Mime Types

User Paul Tarjan said in a comment:

> There is a pretty good list on stdicon.com : stdicon.com/mimetypes

This website is no longer available, but the most recent archive is https://web.archive.org/web/20161015175648/http://www.stdicon.com/mimetypes

Note that this site doesn't mention "application/x-zip-compressed" (and it's not because of the escaping of slashes either) so it's not perfect.

Solution 11 - Mime Types

I took the list from Apache mime.types as of Fri Sep 29 15:10:29 2017 UTC and wrote a script to convert it to a json mapping. The json is too big for stackoverflow answer. You can find it here mimes.json.

script to generate the mapping:

# mime_to_json.py
# get the mime.types from
# http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup

import sys
import re
import json

mapping = {}
with open(sys.argv[1], "r") as handle:
    for line in handle:
        line = line.strip()
        if line[0] == "#":
            continue
        parts = re.split("\s+", line)
        mime = parts[0]
        del parts[0]
        for ext in parts:
            mapping[ext] = mime

print(json.dumps(mapping, indent=4, sort_keys=True))

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLanceView Question on Stackoverflow
Solution 1 - Mime TypesadrianbanksView Answer on Stackoverflow
Solution 2 - Mime TypesDavanum Srinivas - dimsView Answer on Stackoverflow
Solution 3 - Mime TypesTeddyView Answer on Stackoverflow
Solution 4 - Mime TypesSWdVView Answer on Stackoverflow
Solution 5 - Mime TypesjldupontView Answer on Stackoverflow
Solution 6 - Mime TypesreallyniceView Answer on Stackoverflow
Solution 7 - Mime TypesIshaniNetView Answer on Stackoverflow
Solution 8 - Mime TypesMark LuttonView Answer on Stackoverflow
Solution 9 - Mime TypesjeffradeView Answer on Stackoverflow
Solution 10 - Mime TypesAndrew GrimmView Answer on Stackoverflow
Solution 11 - Mime Typesover_optimisticView Answer on Stackoverflow