HTTP Content-Type Generator
Enter a file name or extension and get the correct Content-Type header, with charset=utf-8 where text needs it, an optional Content-Disposition header that makes the file download under a chosen name, and X-Content-Type-Options: nosniff. Output is ready for Apache, Nginx, IIS, static hosts, Express and PHP.
- Runs in your browser
- No sign-up
- Free to use
How to use HTTP Content-Type Generator
- Type a file name or extension, such as report.pdf.
- Check the media type, or type your own to override it.
- Choose whether the file should open in the browser or download, and under which name.
- Pick your server or language and copy the result.
HTTP Content-Type Generator features
About 200 file types
Media types from the IANA registry, with common unregistered types marked.
Charset rules
Adds UTF-8 to text types and explains why JSON needs none.
Download names
Encodes non-English names with filename* as RFC 6266 describes.
Safety notes
Warns about executable files, user-supplied SVG and HTML, and wrong types such as image/jpg.
Server mappings
AddType, nginx types, IIS mimeMap, header files and code.
Offline
Everything happens in your browser.
When to use HTTP Content-Type Generator
- Fixing a server that sends .wasm, .webmanifest or .mjs files with the wrong type.
- Forcing a CSV or PDF export to download with a proper file name.
- Serving a file name with accents or non-Latin letters correctly.
- Resolving “refused to execute script because its MIME type is not executable” errors.
HTTP Content-Type Generator FAQ
What is the Content-Type header?
It tells the browser what kind of data the response contains, such as text/html, application/pdf or image/png, and for text the character encoding. Browsers use it to decide whether to display, play, run or download the content.
Why does text need charset=utf-8?
Without it, browsers may guess the encoding and show non-English characters as garbage. UTF-8 is the encoding of almost all modern content.
Why does JSON not get a charset?
The JSON standard requires UTF-8, so the media type application/json has no charset parameter. Adding one does no harm but has no effect.
How do I make a file download instead of opening?
Send Content-Disposition: attachment, optionally with a filename. Browsers then save the file instead of displaying it.
What does nosniff do?
It stops browsers from guessing a different type than the one sent. Scripts and style sheets served with the wrong type are then refused, which blocks some attacks but also exposes wrong server settings.
What if my extension is not listed?
Type the media type yourself. For unknown binary data, application/octet-stream is the safe default; it makes browsers download the file.
Media types, charsets and downloads
Every HTTP response that has a body should say what that body is. The Content-Type header carries a media type, written as type/subtype, such as text/css, image/webp or application/pdf, optionally followed by parameters such as charset. Web servers choose the type from the file extension using a table, and when that table lacks an entry the server falls back to a generic type, which is how .wasm, .mjs or .webmanifest files end up being rejected by browsers.
The type matters more than it seems. Browsers refuse to run a script served as text/plain when nosniff is set, WebAssembly streaming requires application/wasm exactly, and an HTML page sent as text/plain is shown as source code. Getting the type wrong in the other direction is dangerous: content uploaded by users and served as text/html or image/svg+xml can run scripts in the context of your site.
Text formats also need an encoding. The charset parameter tells the browser how to turn bytes into characters. UTF-8 covers every language and is the default of modern tools, so it is added automatically for text types here. JSON is the exception: its standard fixes the encoding to UTF-8, so its media type has no charset parameter.
Content-Disposition controls what the browser does with the file. inline asks it to display the content where possible; attachment makes it save the file. The filename parameter suggests a name, but plain header values cannot reliably carry characters outside ASCII, so RFC 6266 adds filename*, which holds a percent-encoded UTF-8 version. The generator writes both, with a simplified ASCII name as fallback for very old clients.
Where the configuration goes depends on the server. Apache uses AddType and AddCharset, usually in .htaccess or the virtual host. Nginx has a types table, normally the mime.types file it includes. IIS maps extensions with mimeMap entries in web.config, and static hosting platforms use headers files with path patterns. In application code you set the headers on the response yourself.