complete list of mime-type <-> file extension mapping

22,284

Solution 1

I just want to let you know, there is a new class for this in framework 4.5

System.Web.MimeMapping.GetMimeMapping(filename);

source: https://msdn.microsoft.com/en-us/library/system.web.mimemapping(v=vs.110).aspx

Solution 2

Using Jürgen's mime.types link and a little command line magic, you can generate the list you want very quickly:

wget -qO- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | egrep -v ^# | awk '{ for (i=2; i<=NF; i++) {print $i" "$1}}' | sort

Solution 3

You have to install apache or nginx or something else and look at the mime.types file.

# MIME type                 Extensions
# application/3gpp-ims+xml
# application/activemessage
application/andrew-inset            ez
# application/applefile
application/applixware              aw
application/atom+xml                atom
application/atomcat+xml             atomcat
# application/atomicmail
application/atomsvc+xml             atomsvc
# application/auth-policy+xml
...
more, more, more over 1300 mine-types.
Share:
22,284
juergen d
Author by

juergen d

Updated on August 01, 2020

Comments

  • juergen d
    juergen d almost 4 years

    I can't find a complete list of mime-type mappings on the internet. I would like to have a list that refers a file extension to every existing mime type.

    The list of all mime-types can be found here:
    http://www.iana.org/assignments/media-types

    but that resource doesn't include the file extension mapping.

    I googled a while and couldn't find a mapping list with all mime-types. Only lists with most common ones. In all lists I found for example this entry is missing:

    application/vnd.openxmlformats-officedocument.wordprocessingml.document   ->  .docx
    

    Does someone know a resource where to find a complete mapping?

  • Jürgen Thelen
    Jürgen Thelen over 12 years
    .. or fetch the mime.types file from a repository like http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/‌​mime.types
  • juergen d
    juergen d over 12 years
    but only the ones not commented out include a mapping. the other are left blank in that file.
  • TheHorse
    TheHorse over 12 years
    commented types usualy didn't support by browsers, so you haven't to use it.
  • Jürgen Thelen
    Jürgen Thelen over 12 years
    @juergen d: yep, but I guess you won't find more than that. File extensions are OS-specific and just meant to indicate which format a file could have, not to guarantee that it does. Afaik there simply is no official standard for such kind of mapping.
  • juergen d
    juergen d over 12 years
    Well I guess that list is complete enough then. Thanks.
  • Miguel Mota
    Miguel Mota over 7 years
    npm module based from your answer github.com/miguelmota/mime-ext