.toml MIME type
TOMLtext & code
application/tomlConfig files like Cargo.toml and pyproject.toml, registered with IANA as application/toml.
| MIME type | application/toml |
|---|---|
| Extensions | .toml |
| Content-Type | application/toml |
| Compress in transit? | Yes — enable gzip or Brotli |
Good to know
- TOML files must be UTF-8, so like JSON the type takes no charset parameter.
- The registration is recent, and most servers' default
mime.typeshave no.tomlentry — they sendtext/plainorapplication/octet-stream. Map it explicitly if a client checks the type.
Serve .toml files with the right type
The response header to send:
Content-Type: application/toml
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
application/toml toml;
Apache (.htaccess or server config)
AddType application/toml .toml
Express
res.set("Content-Type", "application/toml");Python
import mimetypes
mimetypes.add_type("application/toml", ".toml")HTML file input
<input type="file" accept=".toml,application/toml">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.toml | grep -i '^content-type:' file --mime-type file.toml
Frequently asked questions
What is the MIME type for .toml files?
application/toml.
What Content-Type header should a .toml file be served with?
Content-Type: application/toml. It compresses well, so let the server apply gzip or Brotli.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options