# .xml MIME Type: application/xml

> XML documents. application/xml is preferred; text/xml is an equivalent alias.

- MIME type: `application/xml`
- Extensions: .xml
- Also seen as: `text/xml`
- Content-Type header: `application/xml; charset=utf-8`
- Compress in transit: yes

## Good to know

- RSS and Atom feeds have their own types — `application/rss+xml` and `application/atom+xml` — though many feeds are served as `application/xml`.
- The encoding declared in `<?xml version="1.0" encoding="…"?>` should agree with the charset in the header.

## Server configuration

### nginx (inside the types block in mime.types)

```
application/xml xml;
```

### Apache (.htaccess or server config)

```
AddType application/xml .xml
```

### Express

```
res.set("Content-Type", "application/xml; charset=utf-8");
```

### Python

```
import mimetypes

mimetypes.add_type("application/xml", ".xml")
```

### HTML file input

```
<input type="file" accept=".xml,application/xml">
```

## FAQ

### What is the MIME type for .xml files?

`application/xml`. You may also see `text/xml`, but `application/xml` is the one to send.

### What Content-Type header should a .xml file be served with?

`Content-Type: application/xml; 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

- [.html — text/html](https://www.devkult.com/mime/html.md)
- [.svg — image/svg+xml](https://www.devkult.com/mime/svg.md)
- [.json — application/json](https://www.devkult.com/mime/json.md)

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