.yaml MIME type
YAMLtext & code
application/yamlYAML documents. application/yaml was registered by RFC 9512 in 2024; older x- types are still common.
| MIME type | application/yaml |
|---|---|
| Extensions | .yaml, .yml |
| Also seen as | text/yaml, application/x-yaml, text/x-yaml |
| Content-Type | application/yaml; charset=utf-8 |
| Compress in transit? | Yes — enable gzip or Brotli |
Good to know
- Before RFC 9512 there was no official type, so you'll meet
text/yaml,application/x-yamlandtext/x-yamlin older servers and tools. - OpenAPI specs in YAML are typically served as
application/yaml.
Useful here: YAML vs JSON
Serve .yaml files with the right type
The response header to send:
Content-Type: application/yaml; charset=utf-8
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
application/yaml yaml yml;
AddType application/yaml .yaml .yml
res.set("Content-Type", "application/yaml; charset=utf-8");import mimetypes
mimetypes.add_type("application/yaml", ".yaml")
mimetypes.add_type("application/yaml", ".yml")<input type="file" accept=".yaml,.yml,application/yaml">
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.yaml | grep -i '^content-type:' file --mime-type file.yaml
Frequently asked questions
What is the MIME type for .yaml files?
application/yaml. You may also see text/yaml, application/x-yaml, text/x-yaml, but application/yaml is the one to send. The same type covers .yml.
What Content-Type header should a .yaml file be served with?
Content-Type: application/yaml; charset=utf-8. As a text format, include the charset so browsers don't guess the encoding. It compresses well, so let the server apply gzip or Brotli.
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options