# .yaml MIME Type: application/yaml

> YAML 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 header: `application/yaml; charset=utf-8`
- Compress in transit: yes

## 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`.

## Server configuration

### 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">
```

## FAQ

### 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

- [.json — application/json](https://www.devkult.com/mime/json.md)
- [.txt — text/plain](https://www.devkult.com/mime/txt.md)

Open the interactive page: https://www.devkult.com/mime/yaml