Here is an (almost) complete file extensions’s MIME in a JSON format.
You can do these examples: MIME["ppt"]
, MIME["docx"]
, etc
{
"x3d": "application/vnd.hzn-3d-crossword",
"3gp": "video/3gpp",
"3g2": "video/3gpp2",
"mseq": "application/vnd.mseq",
"pwn": "application/vnd.3m.post-it-notes",
"plb": "application/vnd.3gpp.pic-bw-large",
"psb": "application/vnd.3gpp.pic-bw-small",
"pvb": "application/vnd.3gpp.pic-bw-var",
"tcap": "application/vnd.3gpp2.tcap",
"7z": "application/x-7z-compressed",
"abw": "application/x-abiword",
"ace": "application/x-ace-compressed",
"acc": "application/vnd.americandynamics.acc",
"acu": "application/vnd.acucobol",
"atc": "application/vnd.acucorp",
"adp": "audio/adpcm",
"aab": "application/x-authorware-bin",
"aam": "application/x-authorware-map",
"aas": "application/x-authorware-seg",
"air": "application/vnd.adobe.air-application-installer-package+zip",
"swf": "application/x-shockwave-flash",
"fxp": "application/vnd.adobe.fxp",
"pdf": "application/pdf",
"ppd": "application/vnd.cups-ppd",
"dir": "application/x-director",
"xdp": "application/vnd.adobe.xdp+xml",
"xfdf": "application/vnd.adobe.xfdf",
"aac": "audio/x-aac",
"ahead": "application/vnd.ahead.space",
"azf": "application/vnd.airzip.filesecure.azf",
"azs": "application/vnd.airzip.filesecure.azs",
"azw": "application/vnd.amazon.ebook",
"ami": "application/vnd.amiga.ami",
"N/A": "application/andrew-inset",
"apk": "application/vnd.android.package-archive",
"cii": "application/vnd.anser-web-certificate-issue-initiation",
"fti": "application/vnd.anser-web-funds-transfer-initiation",
"atx": "application/vnd.antix.game-component",
"dmg": "application/x-apple-diskimage",
"mpkg": "application/vnd.apple.installer+xml",
"aw": "application/applixware",
"mp3": "audio/mpeg",
"les": "application/vnd.hhe.lesson-player",
"swi": "application/vnd.aristanetworks.swi",
"s": "text/x-asm",
"atomcat": "application/atomcat+xml",
"atomsvc": "application/atomsvc+xml",
"atom": "application/atom+xml",
"ac": "application/pkix-attr-cert",
"aif": "audio/x-aiff",
"avi": "video/x-msvideo",
"aep": "application/vnd.audiograph",
"dxf": "image/vnd.dxf",
"dwf": "model/vnd.dwf",
"par": "text/plain-bas",
"bcpio": "application/x-bcpio",
"bin": "application/octet-stream",
"bmp": "image/bmp",
"torrent": "application/x-bittorrent",
"cod": "application/vnd.rim.cod",
"mpm": "application/vnd.blueice.multipass",
"bmi": "application/vnd.bmi",
"sh": "application/x-sh",
"btif": "image/prs.btif",
"rep": "application/vnd.businessobjects",
"bz": "application/x-bzip",
"bz2": "application/x-bzip2",
"csh": "application/x-csh",
"c": "text/x-c",
"cdxml": "application/vnd.chemdraw+xml",
"css": "text/css",
"cdx": "chemical/x-cdx",
"cml": "chemical/x-cml",
"csml": "chemical/x-csml",
"cdbcmsg": "application/vnd.contact.cmsg",
"cla": "application/vnd.claymore",
"c4g": "application/vnd.clonk.c4group",
"sub": "image/vnd.dvb.subtitle",
"cdmia": "application/cdmi-capability",
"cdmic": "application/cdmi-container",
"cdmid": "application/cdmi-domain",
"cdmio": "application/cdmi-object",
"cdmiq": "application/cdmi-queue",
"c11amc": "application/vnd.cluetrust.cartomobile-config",
"c11amz": "application/vnd.cluetrust.cartomobile-config-pkg",
"ras": "image/x-cmu-raster",
"dae": "model/vnd.collada+xml",
"csv": "text/csv",
"cpt": "application/mac-compactpro",
"wmlc": "application/vnd.wap.wmlc",
"cgm": "image/cgm",
"ice": "x-conference/x-cooltalk",
"cmx": "image/x-cmx",
"xar": "application/vnd.xara",
"cmc": "application/vnd.cosmocaller",
"cpio": "application/x-cpio",
"clkx": "application/vnd.crick.clicker",
"clkk": "application/vnd.crick.clicker.keyboard",
"clkp": "application/vnd.crick.clicker.palette",
"clkt": "application/vnd.crick.clicker.template",
"clkw": "application/vnd.crick.clicker.wordbank",
"wbs": "application/vnd.criticaltools.wbs+xml",
"cryptonote": "application/vnd.rig.cryptonote",
"cif": "chemical/x-cif",
"cmdf": "chemical/x-cmdf",
"cu": "application/cu-seeme",
"cww": "application/prs.cww",
"curl": "text/vnd.curl",
"dcurl": "text/vnd.curl.dcurl",
"mcurl": "text/vnd.curl.mcurl",
"scurl": "text/vnd.curl.scurl",
"car": "application/vnd.curl.car",
"pcurl": "application/vnd.curl.pcurl",
"cmp": "application/vnd.yellowriver-custom-menu",
"dssc": "application/dssc+der",
"xdssc": "application/dssc+xml",
"deb": "application/x-debian-package",
"uva": "audio/vnd.dece.audio",
"uvi": "image/vnd.dece.graphic",
"uvh": "video/vnd.dece.hd",
"uvm": "video/vnd.dece.mobile",
"uvu": "video/vnd.uvvu.mp4",
"uvp": "video/vnd.dece.pd",
"uvs": "video/vnd.dece.sd",
"uvv": "video/vnd.dece.video",
"dvi": "application/x-dvi",
"seed": "application/vnd.fdsn.seed",
"dtb": "application/x-dtbook+xml",
"res": "application/x-dtbresource+xml",
"ait": "application/vnd.dvb.ait",
"svc": "application/vnd.dvb.service",
"eol": "audio/vnd.digital-winds",
"djvu": "image/vnd.djvu",
"dtd": "application/xml-dtd",
"mlp": "application/vnd.dolby.mlp",
"wad": "application/x-doom",
"dpg": "application/vnd.dpgraph",
"dra": "audio/vnd.dra",
"dfac": "application/vnd.dreamfactory",
"dts": "audio/vnd.dts",
"dtshd": "audio/vnd.dts.hd",
"dwg": "image/vnd.dwg",
"geo": "application/vnd.dynageo",
"es": "application/ecmascript",
"mag": "application/vnd.ecowin.chart",
"mmr": "image/vnd.fujixerox.edmics-mmr",
"rlc": "image/vnd.fujixerox.edmics-rlc",
"exi": "application/exi",
"mgz": "application/vnd.proteus.magazine",
"epub": "application/epub+zip",
"eml": "message/rfc822",
"nml": "application/vnd.enliven",
"xpr": "application/vnd.is-xpr",
"xif": "image/vnd.xiff",
"xfdl": "application/vnd.xfdl",
"emma": "application/emma+xml",
"ez2": "application/vnd.ezpix-album",
"ez3": "application/vnd.ezpix-package",
"fst": "image/vnd.fst",
"fvt": "video/vnd.fvt",
"fbs": "image/vnd.fastbidsheet",
"fe_launch": "application/vnd.denovo.fcselayout-link",
"f4v": "video/x-f4v",
"flv": "video/x-flv",
"fpx": "image/vnd.fpx",
"npx": "image/vnd.net-fpx",
"flx": "text/vnd.fmi.flexstor",
"fli": "video/x-fli",
"ftc": "application/vnd.fluxtime.clip",
"fdf": "application/vnd.fdf",
"f": "text/x-fortran",
"mif": "application/vnd.mif",
"fm": "application/vnd.framemaker",
"fh": "image/x-freehand",
"fsc": "application/vnd.fsc.weblaunch",
"fnc": "application/vnd.frogans.fnc",
"ltf": "application/vnd.frogans.ltf",
"ddd": "application/vnd.fujixerox.ddd",
"xdw": "application/vnd.fujixerox.docuworks",
"xbd": "application/vnd.fujixerox.docuworks.binder",
"oas": "application/vnd.fujitsu.oasys",
"oa2": "application/vnd.fujitsu.oasys2",
"oa3": "application/vnd.fujitsu.oasys3",
"fg5": "application/vnd.fujitsu.oasysgp",
"bh2": "application/vnd.fujitsu.oasysprs",
"spl": "application/x-futuresplash",
"fzs": "application/vnd.fuzzysheet",
"g3": "image/g3fax",
"gmx": "application/vnd.gmx",
"gtw": "model/vnd.gtw",
"txd": "application/vnd.genomatix.tuxedo",
"ggb": "application/vnd.geogebra.file",
"ggt": "application/vnd.geogebra.tool",
"gdl": "model/vnd.gdl",
"gex": "application/vnd.geometry-explorer",
"gxt": "application/vnd.geonext",
"g2w": "application/vnd.geoplan",
"g3w": "application/vnd.geospace",
"gsf": "application/x-font-ghostscript",
"bdf": "application/x-font-bdf",
"gtar": "application/x-gtar",
"texinfo": "application/x-texinfo",
"gnumeric": "application/x-gnumeric",
"kml": "application/vnd.google-earth.kml+xml",
"kmz": "application/vnd.google-earth.kmz",
"gqf": "application/vnd.grafeq",
"gif": "image/gif",
"gv": "text/vnd.graphviz",
"gac": "application/vnd.groove-account",
"ghf": "application/vnd.groove-help",
"gim": "application/vnd.groove-identity-message",
"grv": "application/vnd.groove-injector",
"gtm": "application/vnd.groove-tool-message",
"tpl": "application/vnd.groove-tool-template",
"vcg": "application/vnd.groove-vcard",
"h261": "video/h261",
"h263": "video/h263",
"h264": "video/h264",
"hpid": "application/vnd.hp-hpid",
"hps": "application/vnd.hp-hps",
"hdf": "application/x-hdf",
"rip": "audio/vnd.rip",
"hbci": "application/vnd.hbci",
"jlt": "application/vnd.hp-jlyt",
"pcl": "application/vnd.hp-pcl",
"hpgl": "application/vnd.hp-hpgl",
"hvs": "application/vnd.yamaha.hv-script",
"hvd": "application/vnd.yamaha.hv-dic",
"hvp": "application/vnd.yamaha.hv-voice",
"sfd-hdstx": "application/vnd.hydrostatix.sof-data",
"stk": "application/hyperstudio",
"hal": "application/vnd.hal+xml",
"html": "text/html",
"irm": "application/vnd.ibm.rights-management",
"sc": "application/vnd.ibm.secure-container",
"ics": "text/calendar",
"icc": "application/vnd.iccprofile",
"ico": "image/x-icon",
"igl": "application/vnd.igloader",
"ief": "image/ief",
"ivp": "application/vnd.immervision-ivp",
"ivu": "application/vnd.immervision-ivu",
"rif": "application/reginfo+xml",
"3dml": "text/vnd.in3d.3dml",
"spot": "text/vnd.in3d.spot",
"igs": "model/iges",
"i2g": "application/vnd.intergeo",
"cdy": "application/vnd.cinderella",
"xpw": "application/vnd.intercon.formnet",
"fcs": "application/vnd.isac.fcs",
"ipfix": "application/ipfix",
"cer": "application/pkix-cert",
"pki": "application/pkixcmp",
"crl": "application/pkix-crl",
"pkipath": "application/pkix-pkipath",
"igm": "application/vnd.insors.igm",
"rcprofile": "application/vnd.ipunplugged.rcprofile",
"irp": "application/vnd.irepository.package+xml",
"jad": "text/vnd.sun.j2me.app-descriptor",
"jar": "application/java-archive",
"class": "application/java-vm",
"jnlp": "application/x-java-jnlp-file",
"ser": "application/java-serialized-object",
"java": "text/x-java-source,java",
"js": "application/javascript",
"json": "application/json",
"joda": "application/vnd.joost.joda-archive",
"jpm": "video/jpm",
"jpeg": "image/x-citrix-jpeg",
"jpg": "image/x-citrix-jpeg",
"pjpeg": "image/pjpeg",
"jpgv": "video/jpeg",
"ktz": "application/vnd.kahootz",
"mmd": "application/vnd.chipnuts.karaoke-mmd",
"karbon": "application/vnd.kde.karbon",
"chrt": "application/vnd.kde.kchart",
"kfo": "application/vnd.kde.kformula",
"flw": "application/vnd.kde.kivio",
"kon": "application/vnd.kde.kontour",
"kpr": "application/vnd.kde.kpresenter",
"ksp": "application/vnd.kde.kspread",
"kwd": "application/vnd.kde.kword",
"htke": "application/vnd.kenameaapp",
"kia": "application/vnd.kidspiration",
"kne": "application/vnd.kinar",
"sse": "application/vnd.kodak-descriptor",
"lasxml": "application/vnd.las.las+xml",
"latex": "application/x-latex",
"lbd": "application/vnd.llamagraphics.life-balance.desktop",
"lbe": "application/vnd.llamagraphics.life-balance.exchange+xml",
"jam": "application/vnd.jam",
"123": "application/vnd.lotus-1-2-3",
"apr": "application/vnd.lotus-approach",
"pre": "application/vnd.lotus-freelance",
"nsf": "application/vnd.lotus-notes",
"org": "application/vnd.lotus-organizer",
"scm": "application/vnd.lotus-screencam",
"lwp": "application/vnd.lotus-wordpro",
"lvp": "audio/vnd.lucent.voice",
"m3u": "audio/x-mpegurl",
"m4v": "video/x-m4v",
"hqx": "application/mac-binhex40",
"portpkg": "application/vnd.macports.portpkg",
"mgp": "application/vnd.osgeo.mapguide.package",
"mrc": "application/marc",
"mrcx": "application/marcxml+xml",
"mxf": "application/mxf",
"nbp": "application/vnd.wolfram.player",
"ma": "application/mathematica",
"mathml": "application/mathml+xml",
"mbox": "application/mbox",
"mc1": "application/vnd.medcalcdata",
"mscml": "application/mediaservercontrol+xml",
"cdkey": "application/vnd.mediastation.cdkey",
"mwf": "application/vnd.mfer",
"mfm": "application/vnd.mfmp",
"msh": "model/mesh",
"mads": "application/mads+xml",
"mets": "application/mets+xml",
"mods": "application/mods+xml",
"meta4": "application/metalink4+xml",
"mcd": "application/vnd.mcd",
"flo": "application/vnd.micrografx.flo",
"igx": "application/vnd.micrografx.igx",
"es3": "application/vnd.eszigno3+xml",
"mdb": "application/x-msaccess",
"asf": "video/x-ms-asf",
"exe": "application/x-msdownload",
"cil": "application/vnd.ms-artgalry",
"cab": "application/vnd.ms-cab-compressed",
"ims": "application/vnd.ms-ims",
"application": "application/x-ms-application",
"clp": "application/x-msclip",
"mdi": "image/vnd.ms-modi",
"eot": "application/vnd.ms-fontobject",
"xls": "application/vnd.ms-excel",
"xlam": "application/vnd.ms-excel.addin.macroenabled.12",
"xlsb": "application/vnd.ms-excel.sheet.binary.macroenabled.12",
"xltm": "application/vnd.ms-excel.template.macroenabled.12",
"xlsm": "application/vnd.ms-excel.sheet.macroenabled.12",
"chm": "application/vnd.ms-htmlhelp",
"crd": "application/x-mscardfile",
"lrm": "application/vnd.ms-lrm",
"mvb": "application/x-msmediaview",
"mny": "application/x-msmoney",
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide",
"ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
"potx": "application/vnd.openxmlformats-officedocument.presentationml.template",
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"dotx": "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
"obd": "application/x-msbinder",
"thmx": "application/vnd.ms-officetheme",
"onetoc": "application/onenote",
"pya": "audio/vnd.ms-playready.media.pya",
"pyv": "video/vnd.ms-playready.media.pyv",
"ppt": "application/vnd.ms-powerpoint",
"ppam": "application/vnd.ms-powerpoint.addin.macroenabled.12",
"sldm": "application/vnd.ms-powerpoint.slide.macroenabled.12",
"pptm": "application/vnd.ms-powerpoint.presentation.macroenabled.12",
"ppsm": "application/vnd.ms-powerpoint.slideshow.macroenabled.12",
"potm": "application/vnd.ms-powerpoint.template.macroenabled.12",
"mpp": "application/vnd.ms-project",
"pub": "application/x-mspublisher",
"scd": "application/x-msschedule",
"xap": "application/x-silverlight-app",
"stl": "application/vnd.ms-pki.stl",
"cat": "application/vnd.ms-pki.seccat",
"vsd": "application/vnd.visio",
"vsdx": "application/vnd.visio2013",
"wm": "video/x-ms-wm",
"wma": "audio/x-ms-wma",
"wax": "audio/x-ms-wax",
"wmx": "video/x-ms-wmx",
"wmd": "application/x-ms-wmd",
"wpl": "application/vnd.ms-wpl",
"wmz": "application/x-ms-wmz",
"wmv": "video/x-ms-wmv",
"wvx": "video/x-ms-wvx",
"wmf": "application/x-msmetafile",
"trm": "application/x-msterminal",
"doc": "application/msword",
"docm": "application/vnd.ms-word.document.macroenabled.12",
"dotm": "application/vnd.ms-word.template.macroenabled.12",
"wri": "application/x-mswrite",
"wps": "application/vnd.ms-works",
"xbap": "application/x-ms-xbap",
"xps": "application/vnd.ms-xpsdocument",
"mid": "audio/midi",
"mpy": "application/vnd.ibm.minipay",
"afp": "application/vnd.ibm.modcap",
"rms": "application/vnd.jcp.javame.midlet-rms",
"tmo": "application/vnd.tmobile-livetv",
"prc": "application/x-mobipocket-ebook",
"mbk": "application/vnd.mobius.mbk",
"dis": "application/vnd.mobius.dis",
"plc": "application/vnd.mobius.plc",
"mqy": "application/vnd.mobius.mqy",
"msl": "application/vnd.mobius.msl",
"txf": "application/vnd.mobius.txf",
"daf": "application/vnd.mobius.daf",
"fly": "text/vnd.fly",
"mpc": "application/vnd.mophun.certificate",
"mpn": "application/vnd.mophun.application",
"mj2": "video/mj2",
"mpga": "audio/mpeg",
"mxu": "video/vnd.mpegurl",
"mpeg": "video/mpeg",
"m21": "application/mp21",
"mp4a": "audio/mp4",
"mp4": "video/mp4",
"m3u8": "application/vnd.apple.mpegurl",
"mus": "application/vnd.musician",
"msty": "application/vnd.muvee.style",
"mxml": "application/xv+xml",
"ngdat": "application/vnd.nokia.n-gage.data",
"n-gage": "application/vnd.nokia.n-gage.symbian.install",
"ncx": "application/x-dtbncx+xml",
"nc": "application/x-netcdf",
"nlu": "application/vnd.neurolanguage.nlu",
"dna": "application/vnd.dna",
"nnd": "application/vnd.noblenet-directory",
"nns": "application/vnd.noblenet-sealer",
"nnw": "application/vnd.noblenet-web",
"rpst": "application/vnd.nokia.radio-preset",
"rpss": "application/vnd.nokia.radio-presets",
"n3": "text/n3",
"edm": "application/vnd.novadigm.edm",
"edx": "application/vnd.novadigm.edx",
"ext": "application/vnd.novadigm.ext",
"gph": "application/vnd.flographit",
"ecelp4800": "audio/vnd.nuera.ecelp4800",
"ecelp7470": "audio/vnd.nuera.ecelp7470",
"ecelp9600": "audio/vnd.nuera.ecelp9600",
"oda": "application/oda",
"ogx": "application/ogg",
"oga": "audio/ogg",
"ogv": "video/ogg",
"dd2": "application/vnd.oma.dd2+xml",
"oth": "application/vnd.oasis.opendocument.text-web",
"opf": "application/oebps-package+xml",
"qbo": "application/vnd.intu.qbo",
"oxt": "application/vnd.openofficeorg.extension",
"osf": "application/vnd.yamaha.openscoreformat",
"weba": "audio/webm",
"webm": "video/webm",
"odc": "application/vnd.oasis.opendocument.chart",
"otc": "application/vnd.oasis.opendocument.chart-template",
"odb": "application/vnd.oasis.opendocument.database",
"odf": "application/vnd.oasis.opendocument.formula",
"odft": "application/vnd.oasis.opendocument.formula-template",
"odg": "application/vnd.oasis.opendocument.graphics",
"otg": "application/vnd.oasis.opendocument.graphics-template",
"odi": "application/vnd.oasis.opendocument.image",
"oti": "application/vnd.oasis.opendocument.image-template",
"odp": "application/vnd.oasis.opendocument.presentation",
"otp": "application/vnd.oasis.opendocument.presentation-template",
"ods": "application/vnd.oasis.opendocument.spreadsheet",
"ots": "application/vnd.oasis.opendocument.spreadsheet-template",
"odt": "application/vnd.oasis.opendocument.text",
"odm": "application/vnd.oasis.opendocument.text-master",
"ott": "application/vnd.oasis.opendocument.text-template",
"ktx": "image/ktx",
"sxc": "application/vnd.sun.xml.calc",
"stc": "application/vnd.sun.xml.calc.template",
"sxd": "application/vnd.sun.xml.draw",
"std": "application/vnd.sun.xml.draw.template",
"sxi": "application/vnd.sun.xml.impress",
"sti": "application/vnd.sun.xml.impress.template",
"sxm": "application/vnd.sun.xml.math",
"sxw": "application/vnd.sun.xml.writer",
"sxg": "application/vnd.sun.xml.writer.global",
"stw": "application/vnd.sun.xml.writer.template",
"otf": "application/x-font-otf",
"osfpvg": "application/vnd.yamaha.openscoreformat.osfpvg+xml",
"dp": "application/vnd.osgi.dp",
"pdb": "application/vnd.palm",
"p": "text/x-pascal",
"paw": "application/vnd.pawaafile",
"pclxl": "application/vnd.hp-pclxl",
"efif": "application/vnd.picsel",
"pcx": "image/x-pcx",
"psd": "image/vnd.adobe.photoshop",
"prf": "application/pics-rules",
"pic": "image/x-pict",
"chat": "application/x-chat",
"p10": "application/pkcs10",
"p12": "application/x-pkcs12",
"p7m": "application/pkcs7-mime",
"p7s": "application/pkcs7-signature",
"p7r": "application/x-pkcs7-certreqresp",
"p7b": "application/x-pkcs7-certificates",
"p8": "application/pkcs8",
"plf": "application/vnd.pocketlearn",
"pnm": "image/x-portable-anymap",
"pbm": "image/x-portable-bitmap",
"pcf": "application/x-font-pcf",
"pfr": "application/font-tdpfr",
"pgn": "application/x-chess-pgn",
"pgm": "image/x-portable-graymap",
"png": "image/x-png",
"ppm": "image/x-portable-pixmap",
"pskcxml": "application/pskc+xml",
"pml": "application/vnd.ctc-posml",
"ai": "application/postscript",
"pfa": "application/x-font-type1",
"pbd": "application/vnd.powerbuilder6",
"pgp": "application/pgp-signature",
"box": "application/vnd.previewsystems.box",
"ptid": "application/vnd.pvi.ptid1",
"pls": "application/pls+xml",
"str": "application/vnd.pg.format",
"ei6": "application/vnd.pg.osasli",
"dsc": "text/prs.lines.tag",
"psf": "application/x-font-linux-psf",
"qps": "application/vnd.publishare-delta-tree",
"wg": "application/vnd.pmi.widget",
"qxd": "application/vnd.quark.quarkxpress",
"esf": "application/vnd.epson.esf",
"msf": "application/vnd.epson.msf",
"ssf": "application/vnd.epson.ssf",
"qam": "application/vnd.epson.quickanime",
"qfx": "application/vnd.intu.qfx",
"qt": "video/quicktime",
"rar": "application/x-rar-compressed",
"ram": "audio/x-pn-realaudio",
"rmp": "audio/x-pn-realaudio-plugin",
"rsd": "application/rsd+xml",
"rm": "application/vnd.rn-realmedia",
"bed": "application/vnd.realvnc.bed",
"mxl": "application/vnd.recordare.musicxml",
"musicxml": "application/vnd.recordare.musicxml+xml",
"rnc": "application/relax-ng-compact-syntax",
"rdz": "application/vnd.data-vision.rdz",
"rdf": "application/rdf+xml",
"rp9": "application/vnd.cloanto.rp9",
"jisp": "application/vnd.jisp",
"rtf": "application/rtf",
"rtx": "text/richtext",
"link66": "application/vnd.route66.link66+xml",
"rss": "application/rss+xml",
"shf": "application/shf+xml",
"st": "application/vnd.sailingtracker.track",
"svg": "image/svg+xml",
"sus": "application/vnd.sus-calendar",
"sru": "application/sru+xml",
"setpay": "application/set-payment-initiation",
"setreg": "application/set-registration-initiation",
"sema": "application/vnd.sema",
"semd": "application/vnd.semd",
"semf": "application/vnd.semf",
"see": "application/vnd.seemail",
"snf": "application/x-font-snf",
"spq": "application/scvp-vp-request",
"spp": "application/scvp-vp-response",
"scq": "application/scvp-cv-request",
"scs": "application/scvp-cv-response",
"sdp": "application/sdp",
"etx": "text/x-setext",
"movie": "video/x-sgi-movie",
"ifm": "application/vnd.shana.informed.formdata",
"itp": "application/vnd.shana.informed.formtemplate",
"iif": "application/vnd.shana.informed.interchange",
"ipk": "application/vnd.shana.informed.package",
"tfi": "application/thraud+xml",
"shar": "application/x-shar",
"rgb": "image/x-rgb",
"slt": "application/vnd.epson.salt",
"aso": "application/vnd.accpac.simply.aso",
"imp": "application/vnd.accpac.simply.imp",
"twd": "application/vnd.simtech-mindmapper",
"csp": "application/vnd.commonspace",
"saf": "application/vnd.yamaha.smaf-audio",
"mmf": "application/vnd.smaf",
"spf": "application/vnd.yamaha.smaf-phrase",
"teacher": "application/vnd.smart.teacher",
"svd": "application/vnd.svd",
"rq": "application/sparql-query",
"srx": "application/sparql-results+xml",
"gram": "application/srgs",
"grxml": "application/srgs+xml",
"ssml": "application/ssml+xml",
"skp": "application/vnd.koan",
"sgml": "text/sgml",
"sdc": "application/vnd.stardivision.calc",
"sda": "application/vnd.stardivision.draw",
"sdd": "application/vnd.stardivision.impress",
"smf": "application/vnd.stardivision.math",
"sdw": "application/vnd.stardivision.writer",
"sgl": "application/vnd.stardivision.writer-global",
"sm": "application/vnd.stepmania.stepchart",
"sit": "application/x-stuffit",
"sitx": "application/x-stuffitx",
"sdkm": "application/vnd.solent.sdkm+xml",
"xo": "application/vnd.olpc-sugar",
"au": "audio/basic",
"wqd": "application/vnd.wqd",
"sis": "application/vnd.symbian.install",
"smi": "application/smil+xml",
"xsm": "application/vnd.syncml+xml",
"bdm": "application/vnd.syncml.dm+wbxml",
"xdm": "application/vnd.syncml.dm+xml",
"sv4cpio": "application/x-sv4cpio",
"sv4crc": "application/x-sv4crc",
"sbml": "application/sbml+xml",
"tsv": "text/tab-separated-values",
"tiff": "image/tiff",
"tao": "application/vnd.tao.intent-module-archive",
"tar": "application/x-tar",
"tcl": "application/x-tcl",
"tex": "application/x-tex",
"tfm": "application/x-tex-tfm",
"tei": "application/tei+xml",
"txt": "text/plain",
"dxp": "application/vnd.spotfire.dxp",
"sfs": "application/vnd.spotfire.sfs",
"tsd": "application/timestamped-data",
"tpt": "application/vnd.trid.tpt",
"mxs": "application/vnd.triscape.mxs",
"t": "text/troff",
"tra": "application/vnd.trueapp",
"ttf": "application/x-font-ttf",
"ttl": "text/turtle",
"umj": "application/vnd.umajin",
"uoml": "application/vnd.uoml+xml",
"unityweb": "application/vnd.unity",
"ufd": "application/vnd.ufdl",
"uri": "text/uri-list",
"utz": "application/vnd.uiq.theme",
"ustar": "application/x-ustar",
"uu": "text/x-uuencode",
"vcs": "text/x-vcalendar",
"vcf": "text/x-vcard",
"vcd": "application/x-cdlink",
"vsf": "application/vnd.vsf",
"wrl": "model/vrml",
"vcx": "application/vnd.vcx",
"mts": "model/vnd.mts",
"vtu": "model/vnd.vtu",
"vis": "application/vnd.visionary",
"viv": "video/vnd.vivo",
"ccxml": "application/ccxml+xml,",
"vxml": "application/voicexml+xml",
"src": "application/x-wais-source",
"wbxml": "application/vnd.wap.wbxml",
"wbmp": "image/vnd.wap.wbmp",
"wav": "audio/x-wav",
"davmount": "application/davmount+xml",
"woff": "application/x-font-woff",
"wspolicy": "application/wspolicy+xml",
"webp": "image/webp",
"wtb": "application/vnd.webturbo",
"wgt": "application/widget",
"hlp": "application/winhlp",
"wml": "text/vnd.wap.wml",
"wmls": "text/vnd.wap.wmlscript",
"wmlsc": "application/vnd.wap.wmlscriptc",
"wpd": "application/vnd.wordperfect",
"stf": "application/vnd.wt.stf",
"wsdl": "application/wsdl+xml",
"xbm": "image/x-xbitmap",
"xpm": "image/x-xpixmap",
"xwd": "image/x-xwindowdump",
"der": "application/x-x509-ca-cert",
"fig": "application/x-xfig",
"xhtml": "application/xhtml+xml",
"xml": "application/xml",
"xdf": "application/xcap-diff+xml",
"xenc": "application/xenc+xml",
"xer": "application/patch-ops-error+xml",
"rl": "application/resource-lists+xml",
"rs": "application/rls-services+xml",
"rld": "application/resource-lists-diff+xml",
"xslt": "application/xslt+xml",
"xop": "application/xop+xml",
"xpi": "application/x-xpinstall",
"xspf": "application/xspf+xml",
"xul": "application/vnd.mozilla.xul+xml",
"xyz": "chemical/x-xyz",
"yaml": "text/yaml",
"yang": "application/yang",
"yin": "application/yin+xml",
"zir": "application/vnd.zul",
"zip": "application/zip",
"zmm": "application/vnd.handheld-entertainment+xml",
"zaz": "application/vnd.zzazz.deck+xml"
}
Edit:
According to @Octo Poulos suggestions:
- Separated jpeg and jpg MIME into two different keys
- updated the MIME of mp4 format to
video/mp4
This is a list of the MIME Types of all well known and lesser known file formats and kinds of documents from the Microsoft Office family.
You can find the MIME Types in the table ordered by the corresponding application Microsoft Word, Excel, Power Point and Access as well as the extension of the file.
Microsoft Word
Extension | MIME-Type |
DOC | application/msword |
DOCX | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
DOT | application/msword |
DOTX | application/vnd.openxmlformats-officedocument.wordprocessingml.template |
DOCM | application/vnd.ms-word.document.macroEnabled.12 |
DOTM | application/vnd.ms-word.template.macroEnabled.12 |
DOCM | application/vnd.ms-word.document.macroEnabled.12 |
DOTM | application/vnd.ms-word.template.macroEnabled.12 |
WORD | application/msword |
W6W | application/msword |
Microsoft Excel
Extension | MIME-Type |
XLS | application/msexcel |
XLSX | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
XLT | application/msexcel |
XLTX | application/vnd.openxmlformats-officedocument.spreadsheetml.template |
XLA | application/msexcel |
XLW | application/msexcel |
XLSM | application/vnd.ms-excel.sheet.macroEnabled.12 |
XLSB | application/vnd.ms-excel.sheet.binary.macroEnabled.12 |
XLTM | application/vnd.ms-excel.template.macroEnabled.12 |
XLAM | application/vnd.ms-excel.addin.macroEnabled.12 |
Microsoft PowerPoint
Extension | MIME-Type |
PPT | application/mspowerpoint |
PPTX | application/vnd.openxmlformats-officedocument.presentationml.presentation |
POT | application/mspowerpoint |
POTX | application/vnd.openxmlformats-officedocument.presentationml.template |
PPS | application/mspowerpoint |
PPSX | application/vnd.openxmlformats-officedocument.presentationml.slideshow |
PPA | application/mspowerpoint |
PPAM | application/vnd.ms-powerpoint.addin.macroEnabled.12 |
PPTM | application/vnd.ms-powerpoint.presentation.macroEnabled.12 |
PPSM | application/vnd.ms-powerpoint.slideshow.macroEnabled.12 |
POTM | application/vnd.ms-powerpoint.template.macroEnabled.12 |
Microsoft Access
Extension | MIME-Type |
MDB | application/msaccess |
ACCDA | application/msaccess |
ACCDB | application/msaccess |
ACCDE | application/msaccess |
ACCDR | application/msaccess |
ACCDT | application/msaccess |
ADE | application/msaccess |
ADP | application/msaccess |
ADN | application/msaccess |
MDE | application/msaccess |
MDF | application/msaccess |
MDN | application/msaccess |
MDT | application/msaccess |
MDW | application/msaccess |
Other
Extension | MIME-Type |
CALCX | application/vnd.ms-office.calx |
HLP (Microsoft Windows Help) | application/x-winhelp |
MPP (Microsoft Project) | application/msproject |
THMX | application/vnd.ms-officetheme |
WRI (Microsoft Write) | application/mswrite |
I hope, I could help you with this list. If I should have forgotten something, just write a comment.
This topic lists the most common MIME types with corresponding document types, ordered by their common extensions.
The following two important MIME types are the default types:
text/plain
is the default value for textual files. A textual file should be human-readable and must not contain binary data.application/octet-stream
is the default value for all other cases. An unknown file type should use this type. Browsers are particularly careful when manipulating these files to protect users from software vulnerabilities and possible dangerous behavior.
IANA is the official registry of MIME media types and maintains a list of all the official MIME types. This table lists important MIME types for the Web:
Extension | Kind of document | MIME Type |
---|---|---|
.aac |
AAC audio | audio/aac |
.abw |
AbiWord document | application/x-abiword |
.arc |
Archive document (multiple files embedded) | application/x-freearc |
.avif |
AVIF image | image/avif |
.avi |
AVI: Audio Video Interleave | video/x-msvideo |
.azw |
Amazon Kindle eBook format | application/vnd.amazon.ebook |
.bin |
Any kind of binary data | application/octet-stream |
.bmp |
Windows OS/2 Bitmap Graphics | image/bmp |
.bz |
BZip archive | application/x-bzip |
.bz2 |
BZip2 archive | application/x-bzip2 |
.cda |
CD audio | application/x-cdf |
.csh |
C-Shell script | application/x-csh |
.css |
Cascading Style Sheets (CSS) | text/css |
.csv |
Comma-separated values (CSV) | text/csv |
.doc |
Microsoft Word | application/msword |
.docx |
Microsoft Word (OpenXML) | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.eot |
MS Embedded OpenType fonts | application/vnd.ms-fontobject |
.epub |
Electronic publication (EPUB) | application/epub+zip |
.gz |
GZip Compressed Archive | application/gzip |
.gif |
Graphics Interchange Format (GIF) | image/gif |
.htm , .html |
HyperText Markup Language (HTML) | text/html |
.ico |
Icon format | image/vnd.microsoft.icon |
.ics |
iCalendar format | text/calendar |
.jar |
Java Archive (JAR) | application/java-archive |
.jpeg , .jpg |
JPEG images | image/jpeg |
.js |
JavaScript | text/javascript (Specifications: HTML and RFC 9239) |
.json |
JSON format | application/json |
.jsonld |
JSON-LD format | application/ld+json |
.mid , .midi |
Musical Instrument Digital Interface (MIDI) | audio/midi , audio/x-midi |
.mjs |
JavaScript module | text/javascript |
.mp3 |
MP3 audio | audio/mpeg |
.mp4 |
MP4 video | video/mp4 |
.mpeg |
MPEG Video | video/mpeg |
.mpkg |
Apple Installer Package | application/vnd.apple.installer+xml |
.odp |
OpenDocument presentation document | application/vnd.oasis.opendocument.presentation |
.ods |
OpenDocument spreadsheet document | application/vnd.oasis.opendocument.spreadsheet |
.odt |
OpenDocument text document | application/vnd.oasis.opendocument.text |
.oga |
OGG audio | audio/ogg |
.ogv |
OGG video | video/ogg |
.ogx |
OGG | application/ogg |
.opus |
Opus audio | audio/opus |
.otf |
OpenType font | font/otf |
.png |
Portable Network Graphics | image/png |
.pdf |
Adobe Portable Document Format (PDF) | application/pdf |
.php |
Hypertext Preprocessor (Personal Home Page) | application/x-httpd-php |
.ppt |
Microsoft PowerPoint | application/vnd.ms-powerpoint |
.pptx |
Microsoft PowerPoint (OpenXML) | application/vnd.openxmlformats-officedocument.presentationml.presentation |
.rar |
RAR archive | application/vnd.rar |
.rtf |
Rich Text Format (RTF) | application/rtf |
.sh |
Bourne shell script | application/x-sh |
.svg |
Scalable Vector Graphics (SVG) | image/svg+xml |
.tar |
Tape Archive (TAR) | application/x-tar |
.tif , .tiff |
Tagged Image File Format (TIFF) | image/tiff |
.ts |
MPEG transport stream | video/mp2t |
.ttf |
TrueType Font | font/ttf |
.txt |
Text, (generally ASCII or ISO 8859-n) | text/plain |
.vsd |
Microsoft Visio | application/vnd.visio |
.wav |
Waveform Audio Format | audio/wav |
.weba |
WEBM audio | audio/webm |
.webm |
WEBM video | video/webm |
.webp |
WEBP image | image/webp |
.woff |
Web Open Font Format (WOFF) | font/woff |
.woff2 |
Web Open Font Format (WOFF) | font/woff2 |
.xhtml |
XHTML | application/xhtml+xml |
.xls |
Microsoft Excel | application/vnd.ms-excel |
.xlsx |
Microsoft Excel (OpenXML) | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.xml |
XML | application/xml is recommended as of RFC 7303 (section 4.1), but text/xml is still used sometimes. You can assign a specific MIME type to a file with .xml extension depending on how its contents are meant to be interpreted. For instance, an Atom feed is application/atom+xml , but application/xml serves as a valid default. |
.xul |
XUL | application/vnd.mozilla.xul+xml |
.zip |
ZIP archive | application/zip |
.3gp |
3GPP audio/video container | video/3gpp ; audio/3gpp if it doesn’t contain video |
.3g2 |
3GPP2 audio/video container | video/3gpp2 ; audio/3gpp2 if it doesn’t contain video |
.7z |
7-zip archive | application/x-7z-compressed |
This article describes MIME Types and the corresponding file extension of the Microsoft Office documents. It will very be useful for document analysis, and you can easily define ContentType for the Microsoft Office associated documents in ASP.NET applications. Also you can use this details to customize MIME types in IIS server configuration.
For Microsoft Office Excel, you can define content type like this example.
Aspx page
<%response.ContentType=“application/vnd.ms-excel”%>
C#
Response.ContentType = “application/vnd.ms-excel”;
The following table lists the MIME types and file extensions that are associated with the Microsoft Office documents.
Extension | MIME Type |
.doc | application/msword |
.dot | application/msword |
.docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.dotx | application/vnd.openxmlformats-officedocument.wordprocessingml.template |
.docm | application/vnd.ms-word.document.macroEnabled.12 |
.dotm | application/vnd.ms-word.template.macroEnabled.12 |
.xls | application/vnd.ms-excel |
.xlt | application/vnd.ms-excel |
.xla | application/vnd.ms-excel |
.xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.xltx | application/vnd.openxmlformats-officedocument.spreadsheetml.template |
.xlsm | application/vnd.ms-excel.sheet.macroEnabled.12 |
.xltm | application/vnd.ms-excel.template.macroEnabled.12 |
.xlam | application/vnd.ms-excel.addin.macroEnabled.12 |
.xlsb | application/vnd.ms-excel.sheet.binary.macroEnabled.12 |
.ppt | application/vnd.ms-powerpoint |
.pot | application/vnd.ms-powerpoint |
.pps | application/vnd.ms-powerpoint |
.ppa | application/vnd.ms-powerpoint |
.pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation |
.potx | application/vnd.openxmlformats-officedocument.presentationml.template |
.ppsx | application/vnd.openxmlformats-officedocument.presentationml.slideshow |
.ppam | application/vnd.ms-powerpoint.addin.macroEnabled.12 |
.pptm | application/vnd.ms-powerpoint.presentation.macroEnabled.12 |
.potm | application/vnd.ms-powerpoint.template.macroEnabled.12 |
.ppsm | application/vnd.ms-powerpoint.slideshow.macroEnabled.12 |
Thanks,
Morgan
Software Developer
title | slug | page-type |
---|---|---|
MIME types (IANA media types) |
Web/HTTP/Basics_of_HTTP/MIME_types |
guide |
{{HTTPSidebar}}
A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format of a document, file, or assortment of bytes.
MIME types are defined and standardized in IETF’s {{RFC(6838)}}.
The Internet Assigned Numbers Authority (IANA) is responsible for all official MIME types, and you can find the most up-to-date and complete list at their Media Types page.
Warning: Browsers use the MIME type, not the file extension, to determine how to process a URL,
so it’s important that web servers send the correct MIME type in the response’s {{HTTPHeader(«Content-Type»)}} header.
If this is not correctly configured, browsers are likely to misinterpret the contents of files, sites will not work correctly, and downloaded files may be mishandled.
Structure of a MIME type
A MIME type most commonly consists of just two parts: a type and a subtype, separated by a slash (/
) — with no whitespace between:
The type represents the general category into which the data type falls, such as video
or text
.
The subtype identifies the exact kind of data of the specified type the MIME type represents.
For example, for the MIME type text
, the subtype might be plain
(plain text), html
({{Glossary(«HTML»)}} source code), or calendar
(for iCalendar/.ics
) files.
Each type has its own set of possible subtypes. A MIME type always has both a type and a subtype, never just one or the other.
An optional parameter can be added to provide additional details:
type/subtype;parameter=value
For example, for any MIME type whose main type is text
, you can add the optional charset
parameter to specify the character set used for the
characters in the data.
If no charset
is specified, the default is {{Glossary(«ASCII»)}} (US-ASCII
) unless overridden by the {{Glossary(«user agent», «user agent’s»)}} settings.
To specify a UTF-8 text file, the MIME type text/plain;charset=UTF-8
is used.
MIME types are case-insensitive but are traditionally written in lowercase. The parameter values can be case-sensitive.
Types
There are two classes of type: discrete and multipart.
Discrete types are types which represent a single file or medium, such as a single text or music file, or a single video.
A multipart type represents a document that’s comprised of multiple component parts, each of which may have its own individual MIME type; or, a multipart type may encapsulate multiple files being sent together in one transaction.
For example, multipart MIME types are used when attaching multiple files to an email.
Discrete types
The discrete types currently registered with the IANA are:
application
- : Any kind of binary data that doesn’t fall explicitly into one of the other types;
either data that will be executed or interpreted in some way or binary data that requires a specific application or category of application to use.
Generic binary data (or binary data whose true type is unknown) isapplication/octet-stream
.
Other common examples includeapplication/pdf
,application/pkcs8
, andapplication/zip
.
(See application type registry at IANA)
- : Any kind of binary data that doesn’t fall explicitly into one of the other types;
audio
- : Audio or music data. Examples include
audio/mpeg
,
audio/vorbis
.
(See audio type registry at IANA)
- : Audio or music data. Examples include
example
- : Reserved for use as a placeholder in examples showing how to use MIME types.
These should never be used outside of sample code listings and documentation.
example
can also be used as a subtype;
for instance, in an example related to working with audio on the web, the MIME typeaudio/example
can be used to indicate that the type is a placeholder and should be replaced with an appropriate one when using the code in the real world.
- : Reserved for use as a placeholder in examples showing how to use MIME types.
font
- : Font/typeface data. Common examples include
font/woff
,font/ttf
, andfont/otf
.
(See font type registry at IANA)
- : Font/typeface data. Common examples include
image
- : Image or graphical data including both bitmap and vector still images as well as
animated versions of still image formats such as animated {{Glossary(«GIF»)}} or APNG.
Common examples areimage/jpeg
,image/png
, andimage/svg+xml
.
(See image type registry at IANA)
- : Image or graphical data including both bitmap and vector still images as well as
model
- : Model data for a 3D object or scene. Examples include
model/3mf
andmodel/vrml
.
(See model type registry at IANA)
- : Model data for a 3D object or scene. Examples include
text
- : Text-only data including any human-readable content, source code, or textual data such as comma-separated value (CSV) formatted data.
Examples include:text/plain
,text/csv
, andtext/html
.
(See text type registry at IANA)
- : Text-only data including any human-readable content, source code, or textual data such as comma-separated value (CSV) formatted data.
video
- : Video data or files, such as MP4 movies (
video/mp4
).
(See video type registry at IANA)
- : Video data or files, such as MP4 movies (
For text documents without a specific subtype, text/plain
should be used.
Similarly, for binary documents without a specific or known subtype, application/octet-stream
should be used.
Multipart types
Multipart types indicate a category of document broken into
pieces, often with different MIME types; they can also be used — especially in email
scenarios — to represent multiple, separate files which are all part of the same
transaction. They represent a composite document.
Except for multipart/form-data
, used in the {{HTTPMethod(«POST»)}} method of HTML Forms, and multipart/byteranges
, used with {{HTTPStatus(«206»)}} Partial Content
to send part of a document, HTTP doesn’t handle multipart documents in a special way: the message is transmitted to the browser (which will likely
show a «Save As» window if it doesn’t know how to display the document).
There are two multipart types:
message
- : A message that encapsulates other messages. This can be used, for instance, to represent an email that includes a forwarded message as part of its data,
or to allow sending very large messages in chunks as if it were multiple messages.
Examples includemessage/rfc822
(for forwarded or replied-to message quoting) andmessage/partial
to allow breaking a large message into smaller ones automatically to be reassembled by the recipient.
(See message type registry at IANA)
- : A message that encapsulates other messages. This can be used, for instance, to represent an email that includes a forwarded message as part of its data,
multipart
- : Data that consists of multiple components which may individually have different MIME types.
Examples includemultipart/form-data
(for data produced using the {{domxref(«FormData»)}} API) andmultipart/byteranges
(defined in {{RFC(7233, «», «5.4.1»)}} and used with {{Glossary(«HTTP»)}}’s {{HTTPStatus(206)}}
«Partial Content» response returned when the fetched data is only part of the content, such as is delivered using the {{HTTPHeader(«Range»)}} header).
(See multipart type registry at IANA)
- : Data that consists of multiple components which may individually have different MIME types.
Important MIME types for Web developers
application/octet-stream
This is the default for binary files. As it means unknown binary file, browsers usually don’t execute it, or even ask if it should be executed. They treat it as if the {{HTTPHeader(«Content-Disposition»)}} header was set to attachment
, and propose a «Save As» dialog.
text/plain
This is the default for textual files. Even if it really means «unknown textual file,» browsers assume they can display it.
Note:
text/plain
does not mean «any kind of textual data.»
If they expect a specific kind of textual data, they will likely not consider it a match.
Specifically if they download atext/plain
file from a {{HTMLElement(«link»)}} element declaring a CSS file, they will not recognize it as a valid CSS file if presented withtext/plain
.
The CSS mime typetext/css
must be used.
text/css
CSS files used to style a Web page must be sent with text/css
.
If a server doesn’t recognize the .css
suffix for CSS files, it may send them with text/plain
or application/octet-stream
MIME types.
If so, they won’t be recognized as CSS by most browsers and will be ignored.
text/html
All HTML content should be served with this type. Alternative MIME types for XHTML (like application/xhtml+xml
) are mostly useless nowadays.
Note: Use
application/xml
orapplication/xhtml+xml
if you want XML’s strict parsing rules,<![CDATA[…]]>
sections, or elements that aren’t from HTML/SVG/MathML namespaces.
text/javascript
Per the IANA Media Types registry, RFC 9239, and the HTML specification, JavaScript content should always be served using the MIME type text/javascript
.
No other MIME types are considered valid for JavaScript, and using any MIME type other than text/javascript
may result in scripts that do not load or run.
You may find some JavaScript content incorrectly served with a charset
parameter as part of the MIME type — as an attempt to specify the character set for the script content.
That charset
parameter isn’t valid for JavaScript content, and in most cases will result in a script failing to load.
Legacy JavaScript MIME types
In addition to the text/javascript
MIME type, for historical reasons, the MIME Sniffing Standard
(the definition of how browsers should interpret MIME types and figure
out what to do with content that doesn’t have a valid one) also allows JavaScript to be served using any of the following legacy JavaScript MIME types:
application/javascript
{{deprecated_inline}}application/ecmascript
{{deprecated_inline}}application/x-ecmascript
{{Non-standard_Inline}}application/x-javascript
{{Non-standard_Inline}}text/ecmascript
{{deprecated_inline}}text/javascript1.0
{{Non-standard_Inline}}text/javascript1.1
{{Non-standard_Inline}}text/javascript1.2
{{Non-standard_Inline}}text/javascript1.3
{{Non-standard_Inline}}text/javascript1.4
{{Non-standard_Inline}}text/javascript1.5
{{Non-standard_Inline}}text/jscript
{{Non-standard_Inline}}text/livescript
{{Non-standard_Inline}}text/x-ecmascript
{{Non-standard_Inline}}text/x-javascript
{{Non-standard_Inline}}
Note: Even though any given {{Glossary(«user agent»)}} may support any or all of these, you should only use
text/javascript
.
It’s the only MIME type guaranteed to work now and into the future.
Image types
Files whose MIME type is image
contain image data.
The subtype specifies which specific image file format the data represents.
The following image types are used commonly enough to be considered safe for use on web pages:
image/apng
: Animated Portable Network Graphics (APNG)image/avif
: AV1 Image File Format (AVIF)image/gif
: Graphics Interchange Format (GIF)image/jpeg
: Joint Photographic Expert Group image (JPEG)image/png
: Portable Network Graphics (PNG)image/svg+xml
: Scalable Vector Graphics (SVG)image/webp
: Web Picture format (WEBP)
The Image file type and format guide provides information and recommendations about when to use the different image formats.
Audio and video types
As is the case for images, HTML doesn’t mandate that web browsers support any specific file and codec types for the {{HTMLElement(«audio»)}} and {{HTMLElement(«video»)}} elements, so it’s important to consider your target audience and the range of browsers (and versions of those browsers) they may be using when choosing the file type and codecs to use for media.
Our media container formats guide provides a list of the file types that are commonly supported by web browsers,
including information about what their special use cases may be, any drawbacks they have, and compatibility information, along with other details.
The audio codec and video codec guides list the various codecs that web browsers often support, providing compatibility details along with technical information such as how many audio channels they support, what sort of compression is used, and what bit rates and so forth they’re useful at.
The codecs used by WebRTC guide expands upon this by specifically covering the codecs supported by the major web browsers, so you can choose the codecs that best cover the range of browsers you wish to support.
As for MIME types of audio or video files, they typically specify the container format (file type).
The optional codecs parameter can be added to the MIME type to further specify which codecs to use and what options were used to encode the media, such as codec profile, level, or other such information.
The most commonly used MIME types used for web content are listed below.
This isn’t a complete list of all the types that may be available, however.
See the media container formats guide for that.
MIME type | Audio or video type |
---|---|
audio/wave , audio/wav , audio/x-wav , audio/x-pn-wav |
An audio file in the WAVE container format. The PCM audio codec (WAVE codec «1») is often supported, but other codecs have limited support (if any). |
audio/webm |
An audio file in the WebM container format. Vorbis and Opus are the codecs officially supported by the WebM specification. |
video/webm |
A video file, possibly with audio, in the WebM container format. VP8 and VP9 are the most common video codecs; Vorbis and Opus the most common audio codecs. |
audio/ogg |
An audio file in the Ogg container format. Vorbis is the most common audio codec used in such a container; however, Opus is now supported by Ogg as well. |
video/ogg |
A video file, possibly with audio, in the Ogg container format. Theora is the usual video codec used within it; Vorbis is the usual audio codec, although Opus is becoming more common. |
application/ogg |
An audio or video file using the Ogg container format. Theora is the usual video codec used within it; Vorbis is the usual audio codec. |
multipart/form-data
The multipart/form-data
type can be used when sending the values of a completed HTML Form from browser to server.
As a multipart document format, it consists of different parts, delimited by a boundary (a string starting with a double dash --
).
Each part is its own entity with its own HTTP headers, {{HTTPHeader(«Content-Disposition»)}}, and {{HTTPHeader(«Content-Type»)}} for file uploading fields.
Content-Type: multipart/form-data; boundary=aBoundaryString (other headers associated with the multipart document as a whole) --aBoundaryString Content-Disposition: form-data; name="myFile"; filename="img.jpg" Content-Type: image/jpeg (data) --aBoundaryString Content-Disposition: form-data; name="myField" (data) --aBoundaryString (more subparts) --aBoundaryString--
The following <form>
:
<form action="http://localhost:8000/" method="post" enctype="multipart/form-data"> <label>Name: <input name="myTextField" value="Test" /></label> <label><input type="checkbox" name="myCheckBox" /> Check</label> <label> Upload file: <input type="file" name="myFile" value="test.txt" /> </label> <button>Send the file</button> </form>
will send this message:
POST / HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=---------------------------8721656041911415653955004498
Content-Length: 465
-----------------------------8721656041911415653955004498
Content-Disposition: form-data; name="myTextField"
Test
-----------------------------8721656041911415653955004498
Content-Disposition: form-data; name="myCheckBox"
on
-----------------------------8721656041911415653955004498
Content-Disposition: form-data; name="myFile"; filename="test.txt"
Content-Type: text/plain
Simple file.
-----------------------------8721656041911415653955004498--
multipart/byteranges
The multipart/byteranges
MIME type is used to send partial responses to the browser.
When the {{HTTPStatus(«206», «206 Partial Content»)}} status code is sent, this MIME type indicates that the document is composed of several parts, one for each of the
requested ranges. Like other multipart types, the {{HTTPHeader(«Content-Type»)}} uses a boundary
to separate the pieces.
Each piece has a {{HTTPHeader(«Content-Type»)}} header with its actual type and a {{HTTPHeader(«Content-Range»)}} of the range it represents.
HTTP/1.1 206 Partial Content Accept-Ranges: bytes Content-Type: multipart/byteranges; boundary=3d6b6a416f9b5 Content-Length: 385 --3d6b6a416f9b5 Content-Type: text/html Content-Range: bytes 100-200/1270 eta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content --3d6b6a416f9b5 Content-Type: text/html Content-Range: bytes 300-400/1270 -color: #f0f0f2; margin: 0; padding: 0; font-family: "Open Sans", "Helvetica --3d6b6a416f9b5--
Importance of setting the correct MIME type
Most web servers send unrecognized resources as the application/octet-stream
MIME type.
For security reasons, most browsers do not allow setting a custom default action for such resources, forcing the user to save it to disk to use it.
Some common incorrect server configurations:
- RAR-compressed files.
In this case, the ideal would be the true type of the original files; this is often impossible as .RAR files can hold several resources of different types.
In this case, configure the server to sendapplication/x-rar-compressed
. - Audio and video.
Only resources with the correct MIME Type will be played in {{HTMLElement(«video»)}} or {{HTMLElement(«audio»)}} elements.
Be sure to specify the correct media type for audio and video. - Proprietary file types.
Avoid usingapplication/octet-stream
as most browsers do not allow defining a default behavior (like «Open in Word») for this generic MIME type.
A specific type likeapplication/vnd.mspowerpoint
lets users open such files automatically in the presentation software of their choice.
MIME sniffing
In the absence of a MIME type, or in certain cases where browsers believe they are incorrect, browsers may perform MIME sniffing — guessing the correct MIME type by looking at the bytes of the resource.
Each browser performs MIME sniffing differently and under different circumstances.
(For example, Safari will look at the file extension in the URL if the sent MIME type is unsuitable.)
There are security concerns as some MIME types represent executable content.
Servers can prevent MIME sniffing by sending the {{HTTPHeader(«X-Content-Type-Options»)}} header.
Other methods of conveying document type
MIME types are not the only way to convey document type information:
- Filename suffixes are sometimes used, especially on Microsoft Windows.
Not all operating systems consider these suffixes meaningful (such as Linux and macOS), and there is no guarantee they are correct. - Magic numbers. The syntax of different formats allows file-type inference by looking at their byte structure.
For example, GIF files start with the47 49 46 38 39
hexadecimal value (GIF89
), and PNG files with89 50 4E 47
(.PNG
).
Not all file types have magic numbers, so this is not 100% reliable either.
See also
- Web media technologies
- Guide to media types used on the web
- Properly configuring server MIME types
Let’s say you want to create a REST API which returns a Microsoft Word Document.
When a client calls that API the document gets automatically downloaded to their system.
How do you do it?
Here is the algorithm:
STEP1: Create a REST API which returns a byte array
STEP2: Configure the return type of the REST API as “application/octet-stream”
STEP3: Convert the file into a byte array
STEP4: Set headers for Content Type and Content Disposition
STEP5: Return the response along with the byte array and headers
STEP6: Test application
STEP1: Create a REST API
Here is a sample REST API:
@GetMapping(value = "/msworddocument") public ResponseEntity<byte[]> download() { // return response here }
The return type is a response entity with byte array as the response body
STEP2: Configure the return type of the REST API as “application/octet-stream”
Use “produces” attribute of your REST Mapping annotation (I have used @GetMapping ) to specify the return type as “application/octet-stream”:
@GetMapping(value = "/msworddocument", produces = { "application/octet-stream" }) public ResponseEntity<byte[]> download() { //return }
STEP3: Convert the file into a byte array
Load the file you want your user to download and convert it into a byte array:
@GetMapping(value = "/msworddocument", produces = { "application/octet-stream" }) public ResponseEntity<byte[]> download() { try { File file = ResourceUtils.getFile("classpath:test.docx"); byte[] contents = Files.readAllBytes(Paths.get(file.getAbsolutePath())); //return response here } catch (Exception e) { e.printStackTrace(); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } }
I created a word document called test.docx and placed it in the resources folder.
STEP4: Set headers for Content Type and Content Disposition
This is the major change to be done to allow users to download your word document.
The Content Type header should be set to “application/octet-stream”
The Content Disposition header should be set to “attachment” along with the file name (the name in which the file gets downloaded to their local machine)
@GetMapping(value = "/msworddocument", produces = { "application/octet-stream" }) public ResponseEntity<byte[]> download() { try { File file = ResourceUtils.getFile("classpath:test.docx"); byte[] contents = Files.readAllBytes(Paths.get(file.getAbsolutePath())); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); headers.setContentDisposition(ContentDisposition.attachment().filename("yourfile.docx").build()); //return here } catch (Exception e) { e.printStackTrace(); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } }
STEP5: Return the response along with the byte array and headers
Return the byte array and the headers using ResponseEntity object:
@GetMapping(value = "/msworddocument", produces = { "application/octet-stream" }) public ResponseEntity<byte[]> download() { try { File file = ResourceUtils.getFile("classpath:test.docx"); byte[] contents = Files.readAllBytes(Paths.get(file.getAbsolutePath())); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); headers.setContentDisposition(ContentDisposition.attachment().filename("yourfile.docx").build()); return new ResponseEntity<>(contents, headers, HttpStatus.OK); } catch (Exception e) { e.printStackTrace(); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } }
STEP6: Test application
I ran the application and loaded the URL in my browser.
The file got downloaded using the name mentioned under “Content Disposition” header:
That’s it.
Code can be found here:
https://github.com/vijaysrj/downloadmsdocument
Create and configure a new document set content type
SharePoint Server 2013 Enterprise SharePoint in Microsoft 365 Office for business Office 365 Small Business Microsoft 365 admin SharePoint Foundation 2013 More…Less
This topic explains how to enable the Document Sets feature for a site collection, and then how to configure the Document Set content type.
What do you want to do?
-
Enable Document Sets for a site collection
-
Create a Document Set content type
-
Configure or customize a Document Set content type
Enable Document Sets for a site collection
If the Document Sets feature has not been activated for your site collection, you have to activate it before you can create or configure new Document Set content types. You must be a Site Collection Administrator to activate the Document Sets feature.
-
Go to the top-level site in the site collection for which you want to enable Document Sets.
-
On the Site menu, click Site Settings.
-
Under Site Collection Administration, click Site collection features.
-
Find Document Sets in the list, and then click Activate.
Top of Page
Create a Document Set content type
To make it possible for site users to use Document Sets, you must first create and configure a Document Set content type for each set that you want to manage. After you create the content type, add it to the document library where it is used. After you create and configure a Document Set content type, you must add it to the library where you want users to create their Document Sets.
You must be a Site Collection Administrator or a Site Owner to create or configure Document Set content types.
-
On the Site menu, click Site Settings.
-
Under Web Designer Galleries, click Site content types.
-
On the Site Content Types page, click Create.
In the Name and Description section, in the Name box, type the name that you want to use for your new Document Set. This is the name that users will see when they create an instance of a Document Set.
-
In the Description box, type a description of the Document Set.
-
Under Select parent content type from, click Document Set Content Types. (If Document Set Content Types is not an option, the Document Sets feature might not be activated for this site collection.)
In the Group section, specify whether you want to categorize your new Document Set content type inside a new or existing group.
-
Click OK.
When your new Document Set content Type is created, you see the Site Content Type information page for the content type, where you can configure additional settings for it.
Top of Page
Configure or customize a Document Set content type
-
On the Site menu, click Site Settings.
-
Under Web Designer Galleries, click Site content types.
On the Site Content Types page, click the name of the Document Set content type that you want to configure.
-
On the Site Content Type page, under Settings, click Document Set settings.
In the Allowed Content Types section, select the content type group that you want to use. Then, under Available Site Content Types, select the content type you want to allow within this Document Set. Then, click the Add button to move it to the Content Types allowed in the Document Set box. Repeat this step for each content type that you want to include in the Document Set.
-
In the Default Content section, select the content type for which you want to upload default content, and then click Browse to locate the file that you want to upload.
What is default content?Default content is content that is created automatically when you create an instance of a Document Set. For example, suppose that you want a Document Set to manage the product design process. This Document Set might include a Product Design Document (a Microsoft Word document), a Design Drawing (a Microsoft Visio drawing), and Performance Specs (a Microsoft Excel worksheet). Your organization might have a standard document template for the Product Design Document that is prepopulated with information that authors have to finish. You can upload this template as default content. Then, when authors create an instance of the product design Document Set, a copy of the Product Design Document is created for them automatically. They can edit the new copy to add more information. If you opt not to include default content for the content types in the Document Set, no files are automatically created. Authors are able to create them from scratch within the Document Set, or upload documents to the Document Set.
-
You can upload default content for several different content types. To do this, click Add new default content, select the next content type for which you want to specify default content. Click Browse to locate the file that you want to upload. Repeat this step until you have specified all of the desired default content for the individual content types in this Document Set.
-
If you want the name of the Document Set added to the names of individual, select the check box next to Add the name of the Document Set to each file name. Including this information may help users identify files in certain views of the library, especially if a library contains more than one type of Document Set.
In the Shared Columns section, select the columns that you want each content type to share within the Document Set.
Shared columns are read-only for the documents within the Document Set, and they can be edited only for the Document Set itself. When changes are made to the values of the shared columns for the Document Set, these updates will be synchronized to the shared column values.
In the Welcome Page Columns section, specify which columns that you want to display on the Welcome Page for the Document Set.
-
In the Welcome Page section, click Customize the Welcome Page to customize the appearance of the Welcome Page that displays to users for each instance of the Document Set.
-
If you want to apply these Welcome Page changes to any Document Sets that inherit from this Document Set, select the check box next to Update the Welcome Page of Document Sets inheriting from this content type.
In the Update List and Site Content Types section, specify whether you want to update any content types inheriting from this Document Set with the changes that you have made.
-
Click OK.
After you create and configure a Document Set content type, you must add it to the library where you want users to create their Document Sets.
Top of Page
Need more help?
Want more options?
Explore subscription benefits, browse training courses, learn how to secure your device, and more.
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.