Skip to content

MIME Type Lookup: Extension to Content-Type

Enter a file extension to get its MIME type and a ready Content-Type header line, or enter part of a type such as font or image/ to list every extension that uses it.

Runs in your browserFree, no sign-upLast reviewed

Settings

Search by file extension or by MIME type. Leave blank to list everything.

Results update automatically as you type.

.webp

MIME type
image/webp
Content-Type header
Content-Type: image/webp
Category
image
Text-based
No — binary
Other extensions
—

Related types

ExtensionsMIME typeText?

Quick answers

What is the MIME type for a .webp file?
image/webp. It is a binary image format, so the header is simply Content-Type: image/webp with no charset. Older web server configurations that predate the format often lack this mapping and send application/octet-stream instead, which makes the image download or fail to display.
What is the MIME type for .docx and .xlsx?
A .docx file is application/vnd.openxmlformats-officedocument.wordprocessingml.document and an .xlsx file is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. The older .doc and .xls formats use application/msword and application/vnd.ms-excel.
What is the correct MIME type for JavaScript?
text/javascript, for both .js and .mjs files. RFC 9239 made it the single registered type in 2022 and marked application/javascript and the other variants obsolete. Browsers still accept the old names for classic scripts, but module scripts are blocked unless the server sends a JavaScript type.
Is a MIME type the same as a Content-Type?
Nearly. The MIME type is the value, such as text/html. Content-Type is the HTTP header that carries it, optionally with parameters: Content-Type: text/html; charset=utf-8. Media type is the current official name for a MIME type; all three terms describe the same type/subtype label.
What is the MIME type for SVG?
image/svg+xml. SVG is XML text even though it is an image, so this lookup marks it text-based and gives the header Content-Type: image/svg+xml; charset=utf-8. Serving an .svg file as text/plain or text/xml stops browsers rendering it in an img tag.
What MIME type should I use for an unknown file?
application/octet-stream, which means arbitrary binary data. Browsers will not try to display it and offer a download instead. This lookup lists it against .bin and .exe. Use it only when no specific type exists, because it is also the usual cause of files downloading unexpectedly.

What MIME Type Lookup does

A MIME type (also called a media type or content type) is the label a server sends so the browser knows what a file is, for example image/webp for a .webp picture. This MIME type lookup takes an extension, with or without the dot, and returns the type, the full Content-Type header to send, and whether the format is text-based and so should carry charset=utf-8. Type part of a MIME type instead and you get a table of every matching extension. The list is deliberately short: 36 entries covering the formats a website normally serves, from HTML, CSS and JavaScript to images, fonts, audio, video, PDF and Office documents. Leave the box empty to see all of them.

MIME type list: web pages, data and documents

These are the text and document entries exactly as the tool returns them. A Yes in the last column means the tool adds charset=utf-8 to the header.

ExtensionMIME typeCharset added?
.html, .htmtext/htmlYes
.csstext/cssYes
.js, .mjstext/javascriptYes
.jsonapplication/jsonYes
.xmlapplication/xmlYes
.txttext/plainYes
.csvtext/csvYes
.mdtext/markdownYes
.pdfapplication/pdfNo
.docapplication/mswordNo
.docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentNo
.xlsapplication/vnd.ms-excelNo
.xlsxapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetNo
.pptapplication/vnd.ms-powerpointNo
.pptxapplication/vnd.openxmlformats-officedocument.presentationml.presentationNo
.zipapplication/zipNo
.gzapplication/gzipNo
.wasmapplication/wasmNo
.bin, .exeapplication/octet-streamNo

JSON is defined as UTF-8 and has no registered charset parameter, so application/json on its own is also correct; the extra parameter is harmless.

Image, font, audio and video MIME types

The media entries in the tool. All are binary except SVG.

ExtensionMIME typeKind
.pngimage/pngImage
.jpg, .jpegimage/jpegImage
.gifimage/gifImage
.webpimage/webpImage
.avifimage/avifImage
.svgimage/svg+xmlImage (XML text)
.icoimage/x-iconImage
.wofffont/woffFont
.woff2font/woff2Font
.ttffont/ttfFont
.otffont/otfFont
.mp3audio/mpegAudio
.wavaudio/wavAudio
.oggaudio/oggAudio
.mp4video/mp4Video
.webmvideo/webmVideo
.movvideo/quicktimeVideo

For .ico the tool gives image/x-icon, the long-standing name every browser accepts. The name registered with IANA is image/vnd.microsoft.icon; either works for a favicon.

Example lookups and what comes back

Extension with a leading dot

Extension or MIME type: .svg

MIME type image/svg+xml. Content-Type header: Content-Type: image/svg+xml; charset=utf-8. Category image. Text-based: Yes, send a charset.

An extension that shares its type

Extension or MIME type: jpeg

MIME type image/jpeg. Content-Type header: Content-Type: image/jpeg. Text-based: No, binary. Other extensions: jpg.

Searching by top-level type

Extension or MIME type: font

4 matches: .woff font/woff, .woff2 font/woff2, .ttf font/ttf and .otf font/otf, none of them text.

A short query that matches two things

Extension or MIME type: js

The .js panel with text/javascript and Other extensions: mjs, plus a Related types table listing .json as application/json.

Matching is by substring, so js also finds json. The panel always shows the exact extension you typed.

Finding the long Office types

Extension or MIME type: openxml

3 matches: the .docx, .xlsx and .pptx types, each beginning application/vnd.openxmlformats-officedocument.

A format that is not in the list

Extension or MIME type: heic

No MIME type found for "heic".

See the table of other common types further down.

Common MIME types this lookup does not include

The tool holds 36 entries. These formats come up often and are not among them, so they are listed here for reference; searching for them in the box above returns no result.

ExtensionMIME type
.heicimage/heic
.bmpimage/bmp
.tif, .tiffimage/tiff
.flacaudio/flac
.aacaudio/aac
.avivideo/x-msvideo
.eotapplication/vnd.ms-fontobject
.rtfapplication/rtf
.epubapplication/epub+zip
.odtapplication/vnd.oasis.opendocument.text
.icstext/calendar
.jsonldapplication/ld+json
.webmanifestapplication/manifest+json
.tarapplication/x-tar
.7zapplication/x-7z-compressed
.rarapplication/vnd.rar

Where to set the Content-Type once you know it

Looking up the value is half the job. These are the usual places it is configured.

  • nginx: add the pair to the types block or to mime.types, for example image/avif avif; then reload.
  • Apache: AddType image/avif .avif in the server config or an .htaccess file.
  • Node and Express: res.type('json') or res.set('Content-Type', 'application/json; charset=utf-8') before sending the body.
  • Object storage and CDNs: the type is stored as metadata on each object at upload time. A file uploaded without one is usually served as application/octet-stream until the metadata is corrected.
  • HTML forms and fetch: a request body has a Content-Type too, such as application/json for an API call or multipart/form-data for a file upload.
  • After changing it, confirm with curl -I https://example.com/file.webp and read the Content-Type line in the response headers.

Why browsers trust the header and not the extension

A browser decides what to do with a response from its Content-Type header. The extension is only part of the URL and can say anything. A file named styles.css that arrives as text/plain is not applied as a stylesheet, and a module script that arrives as anything other than a JavaScript type is refused with a strict MIME type error in the console.

The most common symptom of a wrong type is a file that downloads when it should open. That is application/octet-stream at work: the server had no mapping for the extension and fell back to the generic binary type. A Content-Disposition: attachment header forces a download regardless of type, so check for that as well.

The charset parameter belongs on text formats only. It tells the browser how to turn bytes into characters, and leaving it off an HTML page can produce garbled accented letters. Images, fonts, video and PDFs have no character encoding, so a charset on them means nothing.

One caution for upload forms: the type a browser reports for an uploaded file is guessed from the extension on the visitor's machine and is easy to fake. Renaming a script to photo.jpg is enough to make it report image/jpeg. Check the file's actual bytes on the server.

How to get your result

  1. 1

    Type a file extension in the Extension or MIME type box, such as webp, .svg or docx. A leading dot is ignored and capitals are accepted.

  2. 2

    Read the panel for that extension: MIME type, Content-Type header, Category, Text-based and Other extensions.

  3. 3

    Copy the Content-Type header line into your server, CDN or API response. If Text-based says Yes, the line already ends with charset=utf-8.

  4. 4

    To search the other way, type a type or part of one, such as application/json, font or image/, and read the table of Extensions, MIME type and Text?.

  5. 5

    Clear the box to list all 36 entries.

Questions people ask

How many file types does this tool cover?
36 entries covering 40 extensions: 8 text and data formats, 7 image formats, 4 font formats, 3 audio and 3 video formats, PDF, two archive types, six Microsoft Office types, WebAssembly and the generic binary type. It is a quick reference for web work, not the full IANA registry, which holds thousands of types.
Can I upload a file to detect its MIME type?
No. This is a lookup by name: you type an extension or a type and it returns the matching entry. It does not read file contents or check magic bytes, so it cannot tell you whether a file really is what its extension claims.
Why does my file download instead of opening in the browser?
Usually the server sent application/octet-stream because it has no type configured for that extension, so the browser treats the file as unknown binary data. Set the correct type for the extension. If the type is already right, look for a Content-Disposition: attachment header, which forces a download.
Which types need charset=utf-8?
Text-based ones: HTML, CSS, JavaScript, JSON, plain text, CSV, Markdown, XML and SVG. The tool marks these as Text-based and appends the parameter to the header for you. Binary formats such as PNG, WOFF2, MP4 and PDF should be sent without it.
What is the difference between application/xml and text/xml?
Both are registered for XML and browsers handle them the same way. application/xml is the general recommendation and is what this lookup returns for .xml. Whichever you use, declare the encoding, either with a charset parameter or in the XML declaration at the top of the file.
What is the MIME type for WOFF2 fonts?
font/woff2, and font/woff for the older WOFF format. Before the font/ top-level type was registered in 2017, servers used names such as application/font-woff2; those still appear in old configurations but font/woff2 is the current value.
What is the MIME type for an MP3 file?
audio/mpeg. There is no audio/mp3 in the official registry, although some software uses that name informally. For comparison, .wav is audio/wav, .ogg is audio/ogg and an .mp4 video is video/mp4.
Does the search match partial text?
Yes. The query is matched as a substring of every extension and every type, ignoring case. Typing xl returns .xls and .xlsx, typing audio returns the three audio formats, and typing text/ returns the six types in the text family.

Looking for something else? Browse all developer tools or see every tool.