devkult_
tools29converters34
home/mime/.yaml

.yaml MIME type

YAMLtext & code

application/yaml

YAML documents. application/yaml was registered by RFC 9512 in 2024; older x- types are still common.

MIME typeapplication/yaml
Extensions.yaml, .yml
Also seen astext/yaml, application/x-yaml, text/x-yaml
Content-Typeapplication/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-yaml and text/x-yaml in 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:

nginx (inside the types block in mime.types)
application/yaml yaml yml;
Apache (.htaccess or server config)
AddType application/yaml .yaml .yml
Express
res.set("Content-Type", "application/yaml; charset=utf-8");
Python
import mimetypes

mimetypes.add_type("application/yaml", ".yaml")
mimetypes.add_type("application/yaml", ".yml")
HTML file input
<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.

Related types

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options